라디오 버튼에 문제가 있습니다. 내가하고있는 일은 고객 객체를 만들고 동시에 고객 기본 클래스에서 각 라디오 버튼의 하나의 bool 속성을 설정하려고합니다. 내가받는 오류 메시지는 "StackOverflowException 처리되지 않았습니다"입니다. 오류는이 "IsClient = value;"를 가리 킵니다. CustomerType 클래스에서. 그들은 스택을 날려 - 내가 (CustomerForm.cs 내부에) 당신의 CustomerType
에라디오 버튼의 C# 설정 bool 속성
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