物业与参数 [英] Property with parameter
本文介绍了物业与参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了一些奇怪的事情到VB.NET,以前从来没有注意到...
I got something strange into VB.NET, never notice before...
我在 VB.NET 具有参数属性>,我想通过VB.NET类,但类对象的对象使用该财产在其他的 C#类不显示该属性,可以在任何一个可以告诉我,我是否可以访问该属性到C#或没有。
I have a class in VB.NET having a property with parameter and I want to use that property in other C# Class by making object of VB.NET class but class object not showing that property, could any one tell me whether I can access that property into C# or not.
- 如果是,如何?
- 如果没有,这是什么意思CLR?
下面是我的代码...
Here is my code...
Public Property AsString(ByVal name As String) As String
Get
//Some code
End Get
Set(ByVal value As String)
//Some code
End Set
End Property
注意:,因为它是编译的DLL我不能改变的VB.NET代码
Note: I can not change VB.NET code as it is compiled DLL.
在此先感谢
推荐答案
参数化属性将被转换为获得_
和 SET_
方法
Parameterised Properties are converted to get_
and set_
methods.
string name = "Foo";
string value = "Bar";
MyObject.set_AsString(name, value);
string fooValue = MyObject.get_AsString(name);
这篇关于物业与参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文