将vb转换为c#,这是
的c#中最好的等价物<ConfigurationProperty("name", IsKey:=True, IsRequired:=True)> _
Public Property Name() As String
Get
Return DirectCast(MyBase.Item("name"), String)
End Get
Set(ByVal value As String)
MyBase.Item("name") = value
End Set
End Property
答案 0 :(得分:1)
它的返回类型字符串,只需将其转换为字符串。尝试以下代码。
[ConfigurationProperty("name", IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)base["name"]; }
set { base["name"] = value; }
}