How I should write: long.MaxValue or Int64.MaxValue?
Are there standard from Microsoft?
How I should write: long.MaxValue or Int64.MaxValue?
Are there standard from Microsoft?
long.MaxValue
because you are coding in c#.
Int64.MaxValue is a .NET type.
This is subjective, but I find Int64.MaxValue easier to read, because the capital letter makes it stand out clearly as a static member of a type called Int64, rather than an instance member of a local variable called long (not that there could ever be a local variable called long of course). But I don't think anyone reading your code is going to be confused whichever way you do it!
I would match it to the type of the variable it is being assigned to. If you are using long in the variable declaration, use long.MaxValue.
Jeffrey Richter writes:
I prefer to use the FCL type names and completely avoid the primitive type names.
...
In C#, long maps to System.Int64, but in a different programming language, long could map to an Int16 or Int32. In fact, C++/CLI does in fact treat long as an Int32. Someone reading source code in one language could easily misinterpret the code's intention if he or she were used to programming in a different programming language. In fact, most languages won't even treat long as a keyword and won't compile code that uses it.