Should I use int or Int32

前端 未结 30 2464
野性不改
野性不改 2020-11-22 11:52

In C#, int and Int32 are the same thing, but I\'ve read a number of times that int is preferred over Int32 with no reason

30条回答
  •  误落风尘
    2020-11-22 12:25

    I always use the aliased types (int, string, etc.) when defining a variable and use the real name when accessing a static method:

    int x, y;
    ...
    String.Format ("{0}x{1}", x, y);
    

    It just seems ugly to see something like int.TryParse(). There's no other reason I do this other than style.

提交回复
热议问题