paul1956 / CSharpToVB

New version of CSharpToVB converter
MIT License
25 stars 9 forks source link

Missing ReadOnly and Get body code #44

Closed VBAndCs closed 4 years ago

VBAndCs commented 4 years ago

C#

    public sealed class BeforeViewPageEventData : EventData
    {
        protected override KeyValuePair<string, object> this[int index] => index switch
        {
            0 => new KeyValuePair<string, object>(nameof(Page), Page),
            1 => new KeyValuePair<string, object>(nameof(ViewContext), ViewContext),
            2 => new KeyValuePair<string, object>(nameof(ActionDescriptor), ActionDescriptor),
            3 => new KeyValuePair<string, object>(nameof(HttpContext), HttpContext),
            _ => throw new IndexOutOfRangeException(nameof(index))
        };
    }

VB:

Option Compare Text
Option Explicit On
Option Infer Off
Option Strict On

Public NotInheritable Class BeforeViewPageEventData
    Inherits EventData
    Default Protected Overrides Property Item(index As Integer) As KeyValuePair(Of String, Object)
        Get
            Return tempVar
        End Get
    End Property
End Class

You missed the ReadOnly and the Select Case in the Get body.

        Default Protected Overrides ReadOnly Property Item(index As Integer) As KeyValuePair(Of String, Object)
            Get
                Select Case index
                    Case 0
                        Return New KeyValuePair(Of String, Object)(NameOf(Page), Page)
                    Case 1
                        Return New KeyValuePair(Of String, Object)(NameOf(ViewContext), ViewContext)
                    Case 2
                        Return New KeyValuePair(Of String, Object)(NameOf(ActionDescriptor), ActionDescriptor)
                    Case 3
                        Return New KeyValuePair(Of String, Object)(NameOf(HttpContext), HttpContext)
                    Case Else
                        Throw New IndexOutOfRangeException(NameOf(index))
                End Select
            End Get
        End Property
paul1956 commented 4 years ago

Will be fixed in 4.2.11.0, Converter 3.3.0.0