回答
在.NET中,常见的内置的类型别名适用于所有原始类型和一些标准类型。每个别名对应于一个实际的.NET类型,并且别名和类型名称可以互换使用。
这里列出了一些C#中的别名。其他.NET语言,可能会使用不同的别名为同一类型(如与VB.NET的情况下)
byte -> System.Byte short -> System.Int16 int -> System.Int32 long -> System.Int64 string -> System.String ...
正如你所看到的,System.Int64
代表64位整数又名一个long
。
不是C#特有的。 VB.NET有相同的。 –
哦,好吧..它被称为Int64把我扔了 – Akash
@MattWilko不完全是,VB中的别名是不同的。例如你有'Integer',而不是'int'。我已经提到了C#特有的。 –
朗== >>的Int64输出:真
诠释== >>的Int32输出:真
的Int64 == >>的Int32输出:假
您只能将Long/Int64转换为Int/Int32,如果它足够小,但您始终可以将Int转换为Long。 Int64/Long支持大于和小于标准Int的数字。
.NET为某些类型使用类型别名。这意味着类型别名与其相对值类型完全等价。正如你从下面的列表中看到的,System.Int64的类型别名是“long”。这里是.NET中的类型别名的完整列表。
//Alias | Relative Data Type
byte | System.Byte
sbyte | System.SByte
short | System.Int16
ushort | System.UInt16
int | System.Int32
uint | System.UInt32
long | System.Int64
ulong | System.UInt64
float | System.Single
double | System.Double
decimal | System.Decimal
string | System.String
bool | System.Boolean
object | System.Object
“在.NET中,原始类型只是它们等价结构的捷径” - 你也许是指“在C#中,某些数据类型关键字完全等价于某些”系统“值类型? – AakashM
- 1. 为什么Int64.MaxValue返回Long?
- 2. 为什么在Random.Next中minValue == maxValue?
- 3. 为什么Serialrialuid在java中很长?
- 4. 为什么IIS7需要很长时间
- 5. XmlSerializer.Serialize需要很长时间...为什么?
- 6. 什么是很长很长和长整型
- 7. 为什么TimeSpan不是Int64的typedef?
- 8. 为什么字符长度很长时会出现在底部?
- 9. 的作用是什么很长很长的常量
- 10. 为什么Stream.Position长
- 11. 为什么Scala标准库中的Numeric没有`maxValue`?
- 12. 为什么“UInt64 [] arr = new UInt64 [UInt64.MaxValue];”抛出异常?
- 13. 为什么包含minValue,但是Random.Next()专用的maxValue?
- 14. C# - 为什么DateTime.MinValue和MaxValue不是编译时常量?
- 15. 为什么我需要检查大于Int32.MaxValue?
- 16. 什么是SNIReadSyncOverAsync,为什么需要很长时间才能完成?
- 17. 为什么AJAX这么长?
- 18. 为什么我的查询字符串很长?
- 19. 为什么urllib2需要很长时间阅读?
- 20. 为什么grep -w花费的时间比grep长很多?
- 21. 为什么在Oracle DB上插入XML需要很长时间?
- 22. 为什么我的网站首次载入时间很长?
- 23. 为什么AWS Lambda执行时间很长使用pg-promise
- 24. 为什么一个简单的POST需要很长时间?
- 25. 为什么Thread.Join需要很长时间才能返回?
- 26. 为什么MSBuild任务ResolveProjectReferences需要很长时间?
- 27. 为什么PostgreSQL上的SET CONSTRAINTS ALL DEFERRED需要很长时间?
- 28. 为什么java stream.count()返回一个很长的?
- 29. 为什么Fancybox的图片加载时间很长?
- 30. 为什么ITextSharp需要很长时间才能创建pdf?
只是因为Int64 == long – Cybermaxs
int64是很长的。 http://stackoverflow.com/questions/5260314/c-sharp-isnt-a-int64-equal-to-a-long – Willem
'long'是'Int64'的同义词。 'int'是'Int32'的同义词。 – yogi