When I use resharper tool, it just says “use built-in type “string” rather than using “String”. Similarly, it converts UInt32 to just uint.
I have googled this and all I can find is they are aliases. Aliases meaning “Duplicates”. Ok.
But, what exactly do they mean about it ?
- When both are same, why the tool suggests using “string” and “uint” for “String” and “UInt32” ?
- Also, what is the difference between dot-net types and C# types.
Have googled it but couldnt find any satisfying answers.
Thanks.
The answer given by Rafal sums it up, but there are a couple of clarifications I’d like to make: the only case when using keywords rather than type names is necessary is when defining an enum’s underlying type — In that case, using the latter would not be allowed.
Example:
The above won’t compile.
Also, while I generally prefer to use keywords, it must be said that while the types are the same for every language running on the .NET Framework, the keywords are different. For example, while in C#
longis an alias forInt64, in C++/CLI,longis actually anInt32. That can create some confusion when, for instance, porting code between CLI languages.