C# Programming
12-07-2012, 05:38 AM
Hi,
This is little bit of a oops question. As I am not a full time programmer, I am struggling with little bit of basics. any kind of favor would be appreciated.
namespace NameSpaceX.DataModel { class BFPFDataObject { public WDataObject thisObject { get; set; } List children = new List(); public IList Children { get { return children; } } public BFPFDataObject(WDataObject wdoObj) { thisObject = wdoObj; List wdoDBContents = PFAPIUtils.GetContents(wdoObj, false); foreach (WDataObject tempobj in wdoDBContents) { BFPFDataObject _children = new BFPFDataObject(wdoObj); children.Add(_children); } } } }
I would like to know if its a legitimate class definition
WDataObject is the object what i get from a third part lib
using this I can make calls and navigate the tree
List wdoDBContents = PFAPIUtils.GetContents(wdoObj, false);
above function that do this for me,
However if pass the second parameter to be true, then the function make recursive call and return a list which is all in the same hierarchy.
if the parameter is false then it return only the list objects in the next level.
I am struggling to build a hierarchical list and show it on a tree view, can some body offer some help ?!!!
My gut feeling is if I can build the list sucessfully as indicated above I would be able to do the WPF part myself.
Please throw some light on the subject
Regards
Krish
This is little bit of a oops question. As I am not a full time programmer, I am struggling with little bit of basics. any kind of favor would be appreciated.
namespace NameSpaceX.DataModel { class BFPFDataObject { public WDataObject thisObject { get; set; } List children = new List(); public IList Children { get { return children; } } public BFPFDataObject(WDataObject wdoObj) { thisObject = wdoObj; List wdoDBContents = PFAPIUtils.GetContents(wdoObj, false); foreach (WDataObject tempobj in wdoDBContents) { BFPFDataObject _children = new BFPFDataObject(wdoObj); children.Add(_children); } } } }
I would like to know if its a legitimate class definition
WDataObject is the object what i get from a third part lib
using this I can make calls and navigate the tree
List wdoDBContents = PFAPIUtils.GetContents(wdoObj, false);
above function that do this for me,
However if pass the second parameter to be true, then the function make recursive call and return a list which is all in the same hierarchy.
if the parameter is false then it return only the list objects in the next level.
I am struggling to build a hierarchical list and show it on a tree view, can some body offer some help ?!!!
My gut feeling is if I can build the list sucessfully as indicated above I would be able to do the WPF part myself.
Please throw some light on the subject
Regards
Krish