N
Nayan Mansinha
Hi All
How can I store an array of objects in my C# Application.Settings?
I have CMyObject class for which an array is created:
CMyObject[] arr = new CMyObject[2];
arr[0] = new CMyObject();
arr[0].Name = "One";
arr[1] = new CMyObject();
arr[1].Name = "Two";
Properties.Settings.Default.MyObjList = arr; // MyObjList is defined as
CMyObject[] and has "user" scope.
Properties.Settings.Default.Save();
The above code does not work and complains that CMyObject class is not
marked Serializable. So I have tried marking the class serializable as
follows and tried. That too does not work and complains about the same
thing.
[Serializable]
public class CMyObject
{
.....
}
Any suggestions?
TIA
Nayan
How can I store an array of objects in my C# Application.Settings?
I have CMyObject class for which an array is created:
CMyObject[] arr = new CMyObject[2];
arr[0] = new CMyObject();
arr[0].Name = "One";
arr[1] = new CMyObject();
arr[1].Name = "Two";
Properties.Settings.Default.MyObjList = arr; // MyObjList is defined as
CMyObject[] and has "user" scope.
Properties.Settings.Default.Save();
The above code does not work and complains that CMyObject class is not
marked Serializable. So I have tried marking the class serializable as
follows and tried. That too does not work and complains about the same
thing.
[Serializable]
public class CMyObject
{
.....
}
Any suggestions?
TIA
Nayan