How to create a complete generic TreeView like data structure
Posted
by Nima Rikhtegar
on Stack Overflow
See other posts from Stack Overflow
or by Nima Rikhtegar
Published on 2010-06-02T06:12:00Z
Indexed on
2010/06/02
6:33 UTC
Read the original article
Hit count: 265
I want to create a completely generic treeview like structure. some thing like this:
public class TreeView<T, K, L>
{
public T source;
public K parent;
public List<L> children;
}
as you can see in this class source, parent and also the children, all have a different generic data type. also i want my tree view to have unlimited number of levels (not just 3). this way when i want to work with my nodes in the code, all of them are going to be strongly typed. not just objects that i need to convert them to their original type.
is it possible to create this kind of structure in c#, a treeview which all of its nodes are strongly typed?
thanks
© Stack Overflow or respective owner