M
Martin
Hi,
I've got a base/super class with just a default constructor. I want another
constructor, but I can't modify the base class, so I created a sub class
with a constructor like so:
public class MySub:MyBase
{
public MySub(string val):base()
{
base.public1="String";
base.public2=val;
}
}
I use it like so:
MyBase myBase=new MySub("sometext");
The class MySub then has no direct references to it, but there is still a
reference to the sub class.
What I'm finding is that if I look at the the value of myBase.public1
under debug (immediately after the assignment has executed), it says Error:
Cannot obtain value, and furthermore, when I try to serialize this class
using XmlSerializer I get an exception:
"An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There was an error generating the XML document."
Can someone help me solve the problem?
Thanks
Martin
I've got a base/super class with just a default constructor. I want another
constructor, but I can't modify the base class, so I created a sub class
with a constructor like so:
public class MySub:MyBase
{
public MySub(string val):base()
{
base.public1="String";
base.public2=val;
}
}
I use it like so:
MyBase myBase=new MySub("sometext");
The class MySub then has no direct references to it, but there is still a
reference to the sub class.
What I'm finding is that if I look at the the value of myBase.public1
under debug (immediately after the assignment has executed), it says Error:
Cannot obtain value, and furthermore, when I try to serialize this class
using XmlSerializer I get an exception:
"An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There was an error generating the XML document."
Can someone help me solve the problem?
Thanks
Martin