c# - System.Int32 比使用 int 慢吗?

标签 c#

<分区>

Possible Duplicate:
C#, int or Int32? Should I care?

关于 System.Int32 的几个问题:

  1. 是否有任何特定的技术原因导致不允许使用 sizeof(System.Int32)?
  2. 与 int 类型相比,System.Int32 有多快或多慢?
  3. 对 System.Int32 类型的变量调用 System.Runtime.InteropServices.Marshal.SizeOf 结果为 4;这是如何运作的?这个类的大小是否与内部的 int 完全相同?

最佳答案

实际上没有区别。

int == Int32

前者是隐含的 32 位,而 Int32 拼写出来,Int64 和 Int16(分别是长短)也是如此。

关于c# - System.Int32 比使用 int 慢吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3197541/

相关文章:

c# - 身份服务器 : Add claims to access token in hybrid flow in MVC client

c# - 关键值对的简明动态列表

使用 Avocado Rest api 从 yammer 提取数据的 C# 代码

c# - 如何下载没有依赖项的nuget包?

c# - 如何在c#中从Eventhub接收最新消息

c# - 在 iOS 7 中获取字符串的大小

C# 格式化年龄 - 关于天、周、月 - 年

c# - 如何调整 c# 标记图像的大小?

c# - HttpContext.GetOwinContext().GetUserManager<AppRoleManager>() 返回 null

C# 泛型 - 我可以将此类变成泛型吗?