When does it matter whether you use int versus Int32, or string versus String?

前端 未结 8 652
慢半拍i
慢半拍i 2021-01-19 14:02

In C#, the keywords for built-in types are simply aliases for corresponding types in the System namespace.

Generally, it makes no difference whether yo

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-19 14:30

    One issue is that with strange usings or member declarations String/Int32 can map to a different type(i.e. not the one from mscorlib) or even another kind of member, which would lead to problems.

    As Jon mentioned, another issue is that you can't declare enums using an identifier(You get the error "Type byte, sbyte, short, ushort, int, uint, long, or ulong expected").

提交回复
热议问题