本文整理汇总了C#中IObject.GetChild方法的典型用法代码示例。如果您正苦于以下问题:C# IObject.GetChild方法的具体用法?C# IObject.GetChild怎么用?C# IObject.GetChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObject
的用法示例。
在下文中一共展示了IObject.GetChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillTree
/// <summary>
/// Construct a graph of tree view nodes, following the
/// hierarchical organization of descendants beneath a top-level object
/// </summary>
/// <param name="oTarg">the top-level object the tree will model</param>
/// <param name="nodParent">the top-level tree node, to associate with <paramref name="oTarg"/></param>
private void FillTree(IObject oTarg, TreeNode nodParent)
{
var tvNew = new TreeNode(oTarg.Name);
if (nodParent == null)
_treeView.Nodes.Add(tvNew);
else
nodParent.Nodes.Add(tvNew);
for (int i = 0; i < oTarg.PropertyCount; ++i)
{
IProperty pNext = oTarg.GetProperty(i);
tvNew.Nodes.Add(pNext.Name + " = " + pNext.Value);
}
for (int i = 0; i < oTarg.ChildCount; ++i)
FillTree(oTarg.GetChild(i), tvNew);
}
示例2: CopyFrom
/// <summary>
/// Copy another object's properties and children
/// into this object
/// </summary>
/// <param name="oSource">The object to be copied</param>
private void CopyFrom(IObject oSource)
{
for (int i = 0; i < oSource.PropertyCount; ++i)
{
IProperty pNext = oSource.GetProperty(i);
if (PropertyExists(pNext.Name))
SetPropertyValue(pNext.Name, pNext.Value);
else
AddProperty(pNext.Name, pNext.Value);
}
for (int i = 0; i < oSource.ChildCount; ++i)
{
AddChild(new SimpleObject(oSource.GetChild(i)));
}
}