-
October 5th, 2010, 09:54 PM
#1
XML Problem, not all properties get serialized
My project includes a class which is serialized to an XML string but for some reason not all of the properties get serialized and I cannot figure out why, pleas help
In the code below callID and global CallID get serilized but "cause" does not
Code:
[System.Runtime.Serialization.DataMemberAttribute()]
public string callID { get; set; }
[System.Runtime.Serialization.DataMemberAttribute()]
public string globalCallID { get; set; }
[System.Runtime.Serialization.DataMemberAttribute()]
public string cause { get; set; }
this is my serialization code
Code:
public string Serializew(object popo,Encoding _Encoding)
{
System.IO.StreamReader streamReader = null;
System.IO.MemoryStream memoryStream = null;
try
{
memoryStream = new System.IO.MemoryStream();
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, _Encoding);
Serializer.Serialize(xmlTextWriter, popo);
memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
streamReader = new System.IO.StreamReader(memoryStream);
return streamReader.ReadToEnd();
}
finally
{
if ((streamReader != null))
{
streamReader.Dispose();
}
if ((memoryStream != null))
{
memoryStream.Dispose();
}
}
}
private static System.Xml.Serialization.XmlSerializer serializer;
private static System.Xml.Serialization.XmlSerializer Serializer
{
get
{
if ((serializer == null))
{
serializer = new System.Xml.Serialization.XmlSerializer(typeof(ImmMessage));
}
return serializer;
}
}
-
October 6th, 2010, 04:49 AM
#2
Re: XML Problem, not all properties get serialized
Found the problem, it was in my code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|