I need to Deserialize object having 2 fields as string and one dictionary, i tried to convert but it throwing error as "Cannot serialize member MVVMDemo.Model.Student.books of type System.Collections.Generic.Dictionary
"
it is doable when there is no dictionary item in but when i add that dictionary item it fail to convert. throwing error from below line
XmlSerializer serializer = new XmlSerializer(typeof(Student));
Here is my class
public class Student
{
private string firstName;
private string lastName;
public Dictionary<string, string> books;
public Dictionary<string, string> Books
{
get{return books;}
set{books = value;}
}
public string FirstName
{
get{return firstName;}
set
{
if (firstName != value)
{
firstName = value;
}
}
}
public string LastName
{
get { return lastName; }
set
{
if (lastName != value)
{
lastName = value;
}
}
}
}