我在C#中有以下代码:
1)
public class MyBinaryTree<TItem> where TItem : IComparable<TItem>
{ ... };
Run Code Online (Sandbox Code Playgroud)
2)
public class MyBinaryTree<TItem> : IComparable<TItem>
{ ... };
Run Code Online (Sandbox Code Playgroud)
我在这个网站上找到了这个样本,但这并不完全是我想要的方式.
第一个示例/代码告诉我们item(TItem)实现了IComparable接口.
第二个示例/代码告诉我们我们的整个类(MyBinaryTree)实现了IComparable接口.
我不太了解它.我从未使用的第一个例子和我经常使用的第二个例子(这是界面的典型例子).一些建议 - 补充剂?
它在实践中如何应用?
美好的一天.我想找出发件人的许多按钮.
在C#中有类似的东西:
Button b = new Button();
b.Text = "Click 1";
b.Location = new Point(20, 20);
b.Size = new Size(100, 20);
// Our Handler
b.Click += new EventHandler(myClick);
// Implementation of next button...
// Add to form
this.Controls.Add(b);
this.Controls.Add(nextButton);
...
// And our event
private void myClick(object sender, System.EventArgs e)
{
var mysender = ((Button)sender).Name;
doAnything(mysender);
}
Run Code Online (Sandbox Code Playgroud)
我在VBA中没有任何想法(不是VB!).VBA表示Visual Basic for Applications.在VBA中有可能吗?我正在使用Excel.我已经尝试过Application.Caller,但它不起作用.任何样品 - 建议?