I have a simple class ,and i want to initialize it in the constructor as you can see here:
public class CameraSetting
{
public string CameraIP { set; get; }
public string CameraType { set; get; }
public int CameraGroup { set; get; }
public string GateId { set; get; }
public List<CameraSetting> MyList { set; get; }
public CameraSetting()
{
MyList = new List<CameraSetting>()
{
new CameraSetting() { CameraIP = "192", CameraGroup = 0, CameraType = "ورود",GateId = "1"},
new CameraSetting() { CameraIP = "193", CameraGroup = 0, CameraType = "خروج",GateId = "1"},
new CameraSetting() { CameraIP = "194", CameraGroup = 1, CameraType = "ورود",GateId = "2"},
new CameraSetting() { CameraIP = "195", CameraGroup = 1, CameraType = "خروج",GateId = "2"}
};
}
}
In my code i call CameraSetting obj=new CameraSetting();.but it returns this error :
{"Exception of type 'System.StackOverflowException' was thrown."}
