Reputation: 18259
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.
Upvotes: 21
Views: 17636
Reputation: 38778
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.
Upvotes: 24
Reputation: 19169
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 .....
Upvotes: 1
Reputation: 31
Actually... after disassemble I found out that System.Double is a wrapper around double... So double is not a "shortcut" to System.Double.
Upvotes: 2
Reputation: 152
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).
Upvotes: 0
Reputation: 269528
No, there's no difference: double
is a C# keyword that's an alias for the System.Double
type.
Upvotes: 11