2012-10-14 61 views
1

CIL有一些指令,例如ldc.r8 <float64 (num)>, ldc.r4 <float32 (num)>, ldc.i8 <int64 (num)>, ldc.i4.s <int8 (num)>,這些指令是將常量加載到堆棧中的。那麼,這些數據類型(int32, int64, float32, float64)在C#中的等效物是什麼?CIL數據類型和它們在C#中的等效代碼

回答

6
C# type  CIL type .NET Framework type 
============================================ 
short  int16  System.Int16 
int   int32  System.Int32 
long  int64  System.Int64 

float  float32  System.Single 
double  float64  System.Double 

另請參閱the data type summary

+1

不應該是C#類型的float32「float」而不是「single」? – NothingsImpossible

+0

你是完全正確的,解決了這個問題。 – driis

+0

如果long和int64都具有CIL類型int64,那麼在c#中使用long而不是int64有什麼優勢或缺點? –