Relearn dotnet framework int32

以下所有资料整理自MSDN

int32 表示 32 位有符号的整数。

 命名空间:  System 程序集:  mscorlib(在 mscorlib.dll 中)

[SerializableAttribute]
[ComVisibleAttribute(true)]
public struct Int32 : IComparable, IFormattable,
IConvertible, IComparable<int>, IEquatable<int>

Int32 值类型表示值介于 -2,147,483,648 到 +2,147,483,647 之间的有符号整数。

Int32 为比较该类型的实例、将实例值转换为它的 String 表示形式以及将数字的 String 表示形式转换为该类型的实例提供了相应的方法。

有关格式规范代码如何控制值类型的 String 表示形式的信息,请参见 格式化概述

此类型实现 IComparableIComparable<T>IFormattableIConvertible 接口。使用 Convert 类进行转换,而不是使用此类型的 IConvertible 显式接口成员实现。

线程安全


此类型的所有成员都是线程安全的。看似修改了实例状态的成员实际上返回一个用新值实例化的新实例。正如对任何其他类型一样,对于包含此类型的实例的共享变量,也必须通过锁定来保护对其进行的读写,以保证实现线程安全。

方法


  名称说明
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif CompareTo 已重载。 将此实例与指定的对象或 Int32 进行比较,并返回二者相对值的指示。
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif Equals 已重载。 返回一个值,该值指示此实例是否与指定的对象或 Int32 相等。
21x7atza.protmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif Finalize 允许 Object 在“垃圾回收”回收 Object 之前尝试释放资源并执行其他清理操作。 (继承自 Object。)
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif GetHashCode 返回此实例的哈希代码。 (重写 ValueType.GetHashCode()。)
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif GetType 获取当前实例的 Type(继承自 Object。)
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif GetTypeCode 返回值类型 Int32TypeCode
21x7atza.protmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.static(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif Parse 已重载。 将数字的字符串表示形式转换为它的等效 32 位有符号整数。
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif ToString 已重载。 将此实例的数值转换为其等效的字符串表示形式。
21x7atza.pubmethod(zh-cn,VS.90).gif21x7atza.static(zh-cn,VS.90).gif TryParse 已重载。 将数字的字符串表示形式转换为它的等效 32 位有符号整数。一个指示操作是否成功的返回值。

 

字段


  名称说明
21x7atza.pubfield(zh-cn,VS.90).gif21x7atza.static(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif MaxValue 表示 Int32 的最大可能值。此字段为常数。
21x7atza.pubfield(zh-cn,VS.90).gif21x7atza.static(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif MinValue 表示 Int32 的最小可能值。此字段为常数。

显式接口实现


  名称说明
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToBoolean 基础结构。 有关此成员的说明,请参见 IConvertible.ToBoolean
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToByte 基础结构。 有关此成员的说明,请参见 IConvertible.ToByte
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToChar 基础结构。 有关此成员的说明,请参见 IConvertible.ToChar
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToDateTime 基础结构。 不支持此转换。尝试使用此方法将引发 InvalidCastException
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToDecimal 基础结构。 有关此成员的说明,请参见 IConvertible.ToDecimal
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToDouble 基础结构。 有关此成员的说明,请参见 IConvertible.ToDouble
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToInt16 基础结构。 有关此成员的说明,请参见 IConvertible.ToInt16
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToInt32 基础结构。 有关此成员的说明,请参见 IConvertible.ToInt32
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToInt64 基础结构。 有关此成员的说明,请参见 IConvertible.ToInt64
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToSByte 基础结构。 有关此成员的说明,请参见 IConvertible.ToSByte
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToSingle 基础结构。 有关此成员的说明,请参见 IConvertible.ToSingle
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToType 基础结构。 有关此成员的说明,请参见 IConvertible.ToType
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToUInt16 基础结构。 有关此成员的说明,请参见 IConvertible.ToUInt16
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToUInt32 基础结构。 有关此成员的说明,请参见 IConvertible.ToUInt32
21x7atza.pubinterface(zh-cn,VS.90).gif21x7atza.privmethod(zh-cn,VS.90).gif21x7atza.CFW(zh-cn,VS.90).gif21x7atza.xna(zh-cn,VS.90).gif IConvertible.ToUInt64 基础结构。 有关此成员的说明,请参见 IConvertible.ToUInt64

 int intx = new int(); //在reflector里看到的是int intx=0;

 

posted on 2010-09-27 23:35  tneduts  阅读(261)  评论(0编辑  收藏  举报

导航