Redundancy in C#?

前端 未结 17 1535
猫巷女王i
猫巷女王i 2021-02-13 19:28

Take the following snippet:

List distances = new List();

Was the redundancy intended by the language designers? If so, wh

17条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-13 20:01

    Your particular example is indeed a bit verbose but in most ways C# is rather lean.

    I'd much prefer this (C#)

    int i;
    

    to this (VB.NET)

    Dim i as Integer
    

    Now, the particular example you chose is something about .NET in general which is a bit on the long side, but I don't think that's C#'s fault. Maybe the question should be rephrased "Why is .NET code so verbose?"

提交回复
热议问题