I believe the extension method which you created is not of much use but if you are curious to know what the problem is, you are using the extension method wrong. You are accessing it like a static method, in this style you need to pass 3 arguments based on the signature of the method:
TncExtensions.TncNodeAdd(Nodes, this, myTreeViewNode);
Or use it like an extension method:
this.Nodes.TncNodeAdd(this, myTreeViewNode);
I suggest you change the extension method to:
public static int TncNodeAdd(this TreeNodeCollection nodes, MyTreeViewNode_Abstract myTreeViewNode)
{
return nodes.Add(myTreeViewNode);
}
To learn more, take a look at Extension Methods.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…