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

前端 未结 8 658
慢半拍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:42

    The identifiers int, string, bool, etc. are C# language aliases for the real types Int32, String, and Boolean, respectively. It doesn't matter which you use, but when you're writing an API some people prefer to use the actual class types to the aliases.

    Here's an MSDN article that lists the equivalents.

提交回复
热议问题