Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Incorrect conversion of empty arrays (VB.NET to C#)

$
0
0

The following VB-code

Public Class SomeClass
    
    Public Function ReturnArray As Int32()
        Return New Int32() {}
    End Function
    
End Class

is converted into the following (not compilable) C# code:

public class SomeClass {

    public Int32[ ReturnArray() {
        return new Int32[];
    }

}

Expected result (preferred):

public class SomeClass {

    public Int32[ ReturnArray() {
        return new Int32[] {};
    }

}

or alternatively (a bit less preferred because of change of style):

public class SomeClass {

    public Int32[ ReturnArray() {
        return new Int32[0];
    }

}

Best regards, C.


Viewing all articles
Browse latest Browse all 1764

Trending Articles