E
Eric Workman
If I have a class that holds two string values, so for instance.
Public Class myClass{
private string s1;
private string s2;
public myClass(str1, str2){
s1 = str1;
s2 = str2;
}
}
And then another class which I wish to serialize using an
XmlSerializer that holds an instance variable of type myClass, so for
instance.
Public Class mySerializable{
public string str1;
public string str2;
public myClass mc;
public mySerializable(s1, s2, myClass){
str1 = s1;
str2 = s2;
mc = myClass;
}
}
When I Serilize this using an XML Serializer, the values come out fine
for str1 and str2, but for mc it is empty.
My Question is...Is there a way to specify in myClass somehow that
when it is serialized by an XmlSerializer to simply output s1 as its
value? If not, is there any work around to make this work?
Thanks,
Eric Workman
Public Class myClass{
private string s1;
private string s2;
public myClass(str1, str2){
s1 = str1;
s2 = str2;
}
}
And then another class which I wish to serialize using an
XmlSerializer that holds an instance variable of type myClass, so for
instance.
Public Class mySerializable{
public string str1;
public string str2;
public myClass mc;
public mySerializable(s1, s2, myClass){
str1 = s1;
str2 = s2;
mc = myClass;
}
}
When I Serilize this using an XML Serializer, the values come out fine
for str1 and str2, but for mc it is empty.
My Question is...Is there a way to specify in myClass somehow that
when it is serialized by an XmlSerializer to simply output s1 as its
value? If not, is there any work around to make this work?
Thanks,
Eric Workman