问题
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.
回答1:
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.
回答2:
No, there's no difference: double is a C# keyword that's an alias for the System.Double type.
回答3:
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 .....
回答4:
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:
Actually... after disassemble I found out that System.Double is a wrapper around double... So double is not a "shortcut" to System.Double.
来源:https://stackoverflow.com/questions/3951224/is-there-a-meaningful-difference-between-double-and-double-in-net