What is this new[] a shorthand for?

前端 未结 4 798
一整个雨季
一整个雨季 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条回答
  •  旧时难觅i
    2020-12-07 02:59

    It means that new[] is an implicitly typed array. Since it's implicitly typed, you have to assign something to it as in this example. Just as you have to with the var keyword.

提交回复
热议问题