C# TreeView控件的混乱命名

简介:
TreeView的成员:
     Label Edit
    Before Lebel Edit
    After Label Edit

TreeNode的成员:
     Name
     Text

TreeNode的构造函数:
    new TreeNode(string  text );

TreeView添加节点的方法:
    tv.Nodes.Add(string  key , string  text );


上面这些成员名、变量名中充斥了label,name,text,key这4个词,它们有联系么?
答:
label等于text
key等于name

虽然是Text of label,怎么不统一叫个名字,让人不舒服。
key: The name of the node。那为啥不直接叫name。

另外,基本上每个控件都有一个tag属性。存放控件相关数据,所谓相关,基本上是想存什么就存什么。个人觉得叫tag这个名字也比较牵强。









本文转自 h2appy  51CTO博客,原文链接:http://blog.51cto.com/h2appy/122525,如需转载请自行联系原作者
目录
相关文章
|
1月前
|
C# 数据库 开发者
44.c#:combobox控件
44.c#:combobox控件
14 1
|
1月前
|
C# 数据库
40.c#:TreeView 控件
40.c#:TreeView 控件
14 1
|
1月前
|
C# Windows
49.c#:StatusStrip 控件
49.c#:StatusStrip 控件
21 1
49.c#:StatusStrip 控件
|
1月前
|
C# 开发者 Windows
48.c#:toolstrip控件
48.c#:toolstrip控件
15 1
|
1月前
|
C# Windows
47.c#:menustrip控件
47.c#:menustrip控件
13 1
|
1月前
|
存储 缓存 C#
46.c#:datagridview控件
46.c#:datagridview控件
18 1
|
1月前
|
C#
45.c#:listview控件
45.c#:listview控件
10 1
|
1月前
|
C# 数据库 虚拟化
43.c#:listbox控件
43.c#:listbox控件
15 1
|
1月前
|
数据处理 C# UED
42.c#:progressbar控件
42.c#:progressbar控件
15 1
|
1月前
|
C# UED
41.C#:Timer控件
41.C#:Timer控件
14 1