Is there a meaningful difference between “Double”

2019-01-27 13:40发布

As regards best practices, is there a meaningful difference between using:

Double d;

and

double d;

I know best practices are fraught with contradictions, so I know the answers may vary here. I just want to know the pragmatic difference between the two.

5条回答
该账号已被封号
2楼-- · 2019-01-27 13:53

a bit difference here.

-You can have class,parameter,var named "Double" but if u want to name it "double" u must type @double.

-You can use Qualifier for Double but not for double. ex

System.Double d; //Correct
System.double d; //incorrect. Compiler error: Identifier expected for "System." .
Double Double,@double;//Correct
double double;//incorrect ,Identifier expected for both doubles

the same thing for classes and parameters....also the same for String-string,Boolean-bool .....

查看更多
放我归山
3楼-- · 2019-01-27 13:59

There is no difference. double is just an alias for System.Double in C#.

Note that VB.NET doesn't have the same aliasing (int for System.Int32, double for System.Double, etc), so the aliasing is just applicable to C#, not .NET as a whole.

查看更多
女痞
4楼-- · 2019-01-27 14:07

In C# the Double and double are the same, however Double guranateed to be the same across all .NET platforms, and as far as I remember the double IS the same on all platform, but is not guaranteed as such (despite being it de facto).

查看更多
虎瘦雄心在
5楼-- · 2019-01-27 14:12

No, there's no difference: double is a C# keyword that's an alias for the System.Double type.

查看更多
看我几分像从前
6楼-- · 2019-01-27 14:15

Actually... after disassemble I found out that System.Double is a wrapper around double... So double is not a "shortcut" to System.Double.

查看更多
登录 后发表回答