开发者

Why Boolean And bool

From the link ( which is mentioned in Question) my question is that microsoft says "The C# type keywords and t开发者_运维知识库heir aliases are interchangeable" But why we need Aliases, From my point of view Boolean is more meaningful then bool and Int32 is more meaningful then int then why aliases ???


Because C# tries to be a bit like C/C++ for familiarity. You are welcome to use the long names if you wish, but I think most people prefer the short names.


Because programmers are lazy and Microsoft wants to do them a favour.

I prefer the long names but most former C++ programmers will be used to string, int, float and double.


Because in C[1] and C++ the data types are named as bool and int, and C# is designed based on C / C++.

Also Boolean and Int32 are names from the .NET framework which is shared by all CLR languages, but individual language may define their own aliases (e.g. Boolean and Integer in VB.net) to accommodate for the "feel" of that language.

[1]: C99 / with stdbool.h


Because the "System.Boolean" is a value type from mscorlib.dll and the "bool" is keyword from C#. If you want, you can specify your own assembly instead of mscorlib which will implement "bool", "byte", "sbyte", "int", etc...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜