I have a treeview which is made up of IDetail and IAssembly items.
public interface IDetail {
string Nomenclature { get; set; }
string Cost { get; set; }
}
public interface IAssembly:IDetail{
IEnumerable<IDetail> DirectChildren { get; }
IEnumerable<IDetail> LoadChildren();
}
I'm adding the ability to insert childen into the tree. I can add a IDetail child to the IAssembly just fine but want to include ability to add a child to the IDetail. This means I need to convert IDetail to IAssembly so that it can have children.
How do I cast IDetail to IAssembly assuming I'm working within IDetail. Can I cast the object I'm in to IAssembly? this is only a get and I can't set this=(IAssembly)this;
Thanks for reading,
UPDATE
Let me clarify my question a bit.. I don't want to add children to IDetail but if a user decides to branch out the current item more, then the current item of type IDetail will switch to IAssembly, then add IDetail as a child.