public class a{
public string x1 {get;set;}
public string x2 {get;set;}
public string x3 {get;set;}
}
public class b:a{
}
Obviously v
This type of cast is wrong, because you can't cast parents to their children.
Type of a
doesn't know about metainformation of type b
. So you need provide the explicit cast operator to do such things, but in this case you must remove inheritance.
Other option is to define some interface, such as in other questions.
More information:
http://msdn.microsoft.com/en-us/library/ms173105.aspx
http://msdn.microsoft.com/en-us/library/85w54y0a.aspx