Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大家好,如何用 C# 编写这个 VB 源代码
Dim codes As New System.Windows.Forms.Binding("text", Me.bindingSource1, "ATMCode", True)
我试过写
int codes = new Binding("text", this.bindingSource1, "ATMCode", True);
但VS说错误不能隐式转换类型'System.Windows.Forms.Binding'到'int'
var codes = new Binding("text", this.bindingSource1, "ATMCode", true);
上面代码的问题在于它是一个绑定而不是一个 Int。
就像罗伯特说你也可以把它写成......
Binding codes = new Binding("text", this.bindingSource1, "ATMCode", true);
如果您来自 VB,这可能不会那么令人困惑。