C# List definition, parentheses vs curly braces

前端 未结 4 1803
抹茶落季
抹茶落季 2020-12-09 16:00

I\'ve just noticed that when you declare a List in c# you can put parentheses or curly braces at the end.

List myList = new List&l         


        
4条回答
  •  攒了一身酷
    2020-12-09 16:45

    To be short - there is no difference in the objects created.

    But there's more: What you are asking isn't a List specific question - it's a question of object and Collection initialization.

    See here.

提交回复
热议问题