C # to VB.Net conversion utility that correctly handles automatic properties?

I hope this is not considered a duplicate, since it is more pointed than similar issues (I am curious to learn about some weaknesses in C # to VB.net conversion utilities).

I was looking for the use of such a .NET code converter tool to convert a class library to VB, since I am the only one in my group who is comfortable with C #. The problem I am facing is that it does not generate the correct VB for automatic properties. It creates empty get / set routines.

So this is:

public string TransactionType { get; private set; }

Becomes as follows:

Public Property TransactionType() As String
    Get
    End Get
    Private Set(ByVal value As String)
    End Set
End Property

, , - , .

. DeveloperFusion, - ?

Private _TransactionType As String
Public Property TransactionType() As String
    Get
        Return _TransactionType
    End Get
    Private Set(ByVal value As String)
        _TransactionType = value
    End Set
End Property
+3
5

. - , , , .

+4

- Red-Gate http://www.red-gate.com/products/reflector/index.htm . "", , ( ).

, , .NET IL, . - . , 2 , , IL-. , - Reflector .

+2

, ( ( PowerShell)), , . โ€‹โ€‹ .Net 3.5, :

Property TransactionType As String
  Public Get
  Private Set(ByVal value As String)
End Property

, , , , VB.Net # 3.5 ... , 2.0, :

Property TransactionType As String
    Public Get
        Return Me.<TransactionType>k__BackingField
    End Get
    Private Set(ByVal value As String)
        Me.<TransactionType>k__BackingField = value
    End Set
End Property

<CompilerGenerated> _
Private <TransactionType>k__BackingField As String

P.S.: , Reflector, , .pdb, ;)

+2

: , , . , #, "" (.. ), , , .

+1

I would suggest checking out SharpDevelop (sometimes written as #develop). This is an open source .NET environment that, among other things, can convert (with some problems) from C # to VB.NET and vice versa.

+1
source

Source: https://habr.com/ru/post/1697935/


All Articles