I have a method
Publi开发者_开发百科c Property ConfigKeys(ByVal keyName As String) As WinItUtils.Classes.ConfigKey
Get
Return GetConfigKey(keyName)
End Get
Set(ByVal value As WinItUtils.Classes.ConfigKey)
SetConfigKey(value)
End Set
End Property
and converter http://www.developerfusion.com/tools/convert/vb-to-csharp/ gives me
public WinItUtils.Classes.ConfigKey ConfigKeys
{
get { return GetConfigKey(keyName); }
set { SetConfigKey(value); }
}
which is nonsense. Or maybe this is something that I don't know :/ I'm newbie in visual basic, so maybe I'm missing something I'm using .net 4.0
Here is the ConfigKey class:
Namespace Classes
''' <summary>
''' Business class that implements a configuration key from WINIT_CONFIG table.
''' </summary>
''' <remarks></remarks>
Public Class ConfigKey
Implements IEquatable(Of ConfigKey)
Private _resourceKey As String
Private _value As String
Private _id As Integer
Private _handlerId As Integer
Private _configType As WinItUtils.Enums.WinItConfigTypes
Public Sub New()
End Sub
Public Property Id() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
Public ReadOnly Property IsGlobal() As Boolean
Get
Return _handlerId < 0
End Get
End Property
Public Property HandlerId() As Integer
Get
Return _handlerId
End Get
Set(ByVal value As Integer)
_handlerId = value
End Set
End Property
Public Property ResourceKey() As String
Get
Return _resourceKey
End Get
Set(ByVal value As String)
_resourceKey = value
End Set
End Property
Public Property ConfigType() As WinItUtils.Enums.WinItConfigTypes
Get
Return _configType
End Get
Set(ByVal value As WinItUtils.Enums.WinItConfigTypes)
_configType = value
End Set
End Property
Public Property Value() As String
Get
Return _value
End Get
Set(ByVal value As String)
_value = value
End Set
End Property
Public Overrides Function Equals(ByVal obj As Object) As Boolean
Return Equals(TryCast(obj, ConfigKey))
End Function
Public Overloads Function Equals(ByVal other As ConfigKey) As Boolean _
Implements IEquatable(Of ConfigKey).Equals
If other Is Nothing Then
Return False
End If
Return _handlerId = other.HandlerId And _resourceKey.Equals(other.ResourceKey) And _configType = other.ConfigType
End Function
End Class
End Namespace
You don't have a method.
That is a parameterized property, which C# does not support.
There is no direct translation of your code into C#.
Instead, you should make a regular property that returns a Dictionary<string, ConfigKey>
.
精彩评论