ラジオボタンに問題があります。私がやっていることは、顧客オブジェクトを作成すると同時に、顧客基本クラスの各ラジオボタンの1つのboolプロパティを設定することです。私が得るエラーメッセージは、 "StackOverflowExceptionは手作業ではありませんでした"です。エラーは、この "IsClient = value;"を指しています。 CustomerTypeクラスに追加します。私は(CustomerForm.cs内側)Customerオブジェクトを作成するのはここラジオボタンからboolプロパティを設定するC#
が
m_customer = new Customer(radioClient.Checked, radioProspect.Checked, radioCompany.Checked, radioPrivate.Checked);
public class Customer : CustomerType
{
private Contact m_contact;
private string m_id;
public Customer()
{
m_id = string.Empty;
}
public Customer(bool client, bool prospect, bool company, bool priv)
{
base.IsClient = client;
base.IsProspect = prospect;
base.IsCompany = company;
base.IsPrivate = priv;
m_id = string.Empty;
}
public Customer(Contact contactData)
{ m_contact = contactData; }
public Customer(string id, Contact contact)
{
m_id = id;
m_contact = contact;
}
public Contact ContactData
{
get { return m_contact; }
set {
if (value != null)
m_contact = value;
}
}
public string Id
{
get { return m_id; }
set { m_id = value; }
}
public override string ToString()
{
return m_contact.ToString();
}
}
public class CustomerType
{
public bool IsClient
{
get { return IsClient; }
set { IsClient = value; }
}
public bool IsCompany
{
get { return IsCompany; }
set { IsCompany = value; }
}
public bool IsPrivate
{
get { return IsPrivate; }
set { IsPrivate = value; }
}
public bool IsProspect
{
get { return IsProspect; }
set { IsProspect = value; }
}
}
これを修正するにはOPはおそらく自動プロパティを実装しようとする必要がありますか? ... –
@jameslewis - それは一つの選択肢です。 – Oded
LOLは明らかにそうではありません!乾杯! – Craig