In VB.NET, you can instantiate and immediately use an array like this:
Dim b as Boolean = {"string1", "string2"}.Contains("string1")
In C #, however, it looks like you should do this:
bool b = new string[] { "string1", "string2" }.Contains("string1");
Does C # have an equivalent shorthand syntax that uses type inference to determine the type of an array without explicitly declaring it?
source share