K
kumar.senthil
Hi,
I'm using XmlSerializer to create an object from the XML string. I
would like to know whether I can get a null value for an empty XML
element.
Actually the XmlSerializer assigns "" (empty string) for a string
if the corresponding element is missing in the XML.
Input XML:
<DemoClass><A>some value</A><B></B><DemoClass>
Class Structure:
public class DemoClass
{
public string A;
public string B;
}
It creates the object with the proper value for "A" and empty
string B.
Is there any way I can get null for "B" instead of "" (empty
string) ?
Thanks,
Kumar
I'm using XmlSerializer to create an object from the XML string. I
would like to know whether I can get a null value for an empty XML
element.
Actually the XmlSerializer assigns "" (empty string) for a string
if the corresponding element is missing in the XML.
Input XML:
<DemoClass><A>some value</A><B></B><DemoClass>
Class Structure:
public class DemoClass
{
public string A;
public string B;
}
It creates the object with the proper value for "A" and empty
string B.
Is there any way I can get null for "B" instead of "" (empty
string) ?
Thanks,
Kumar