What is this new[] a shorthand for?

前端 未结 4 761
一整个雨季
一整个雨季 2020-12-07 02:35

I can\'t seem to find any documentation on what new[] is supposed to be. From the example below it seems to be an object array shorthand

var json = new[] {
          


        
4条回答
  •  温柔的废话
    2020-12-07 02:49

    It's implicit typing. Since all the elements in that collection are object arrays, the compiler can deduce that the array itself must be a collection of object arrays.

提交回复
热议问题