I have:
public class Element : XmlElement
{
// there is constructor, not important
public string ElementSomething {get;set;}
}
public class Cat: Element {
// there is constructor, not important
public string CatSomething {get;set;}
}
And now an epic question:
public void SomeMethod()
{
XmlElement xmlelem = new XmlElement (/*some params, not important */);
Element elem = new Element (/*some params, not important*/);
elem.ElementSomething = "Element";
Cat catelem = new Cat(/*some params, not important*/);
catelem .CatSomething = "Cat";
}
How to cast elem
to Cat
and back?
Cat newcat = elem as Cat;
don't work.