type conversion - VB6 to C#: Hash Sign For Converting to Double -


i converting vb6 project c#, , have noticed vb6 allowed add # after integer during calculation mark (and convert) double.

example:

if valueasdeg >= (1# / 60#) err.raise - 1 

is there similar way in c#?

use suffix "d", e.g. 1d

by default, real numeric literal on right-hand side of assignment operator treated double. however, if want integer number treated double, use suffix d or d.

http://msdn.microsoft.com/en-us/library/678hzkk9(v=vs.110).aspx

double result = 1 / 60; console.writeline( result ); 

output: 0

double result = 1d / 60d; console.writeline( result ); 

output: 0.0166666666666667

note there similar suffixes float "f", decimal "m", , long "l", support unsigned suffixes.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -