In Visual Studio for Mac, if I wrote something like this:
public class Foo {
public int[,] Property1 { get; }
}
Put the cursor on the empty line there, and press Command + I to generate a constructor:
And this happens:
public class Foo {
public int[,] Property1 { get; }
public Foo(int[*, *] property1)
{
Property1 = property1;
}
}
The constructor is generated, but the type of the parameter's type is int[*, *]
, which does not compile.
I am thinking that this is Visual Studio prompting me to write something to replace those asterisks, or maybe not? Since this does not happen with single dimensional arrays, and I do not know of any syntax in C# that allows you to put stuff in []
in a place like this.
For a three dimensional array, it generates 3 asterisks:
public Foo(int[*, *, *] property1)
{
Property1 = property1;
}
What is causing Visual Studio to do this?
My version of Visual Studio is: Visual Studio for Mac Community 7.2.2 (build 11).
I tried to test this on the Windows version of Visual Studio - Visual Studio Community 2015. But I failed to find a button that does this. According to this answer, there is a generate constructor button in "Quick Actions", but I failed to find one. Maybe it's not in the Community version?