public abstract class ValueType
Object
ValueType
mscorlib
BCL
Provides support for value types. This class is the base class for all value types.
[Note: Data types are separated into value types and reference types. Value types are either stack-allocated or allocated inline in a structure. Reference types are heap-allocated. Both reference and value types are derived from the ultimate base class Object. In cases where a value type needs to act like an object, a wrapper that makes the value type look like a reference object is allocated on the heap, and the value type's value is copied into it. The wrapper is marked so that the system knows that it contains a value type. This process is known as boxing, and the reverse process is known as unboxing. Boxing and unboxing allow any type to be treated as an object.]
In the following example, the number 3 is boxed as a Int32, and System.Int32.ToString () is called.
using System; class Boxer { public static void Main() { Console.WriteLine("Value is {0}.", 3.ToString()); } }The output is
Value is 3.
System Namespace
ValueType Constructors
ValueType Methods
ValueType.Equals Method
ValueType.GetHashCode Method
ValueType.ToString Method
protected ValueType();
Constructs a new instance of the ValueType class.
System.ValueType Class, System Namespace
public override bool Equals(object obj);
Determines whether the current instance and a specified Object represent the same value.
- obj
- The Object to compare the current instance to.
true
if obj and the current instance are of the same type and represent the same value; otherwise,false
.
[Note: This method overrides System.Object.Equals(System.Object) .]
System.ValueType Class, System Namespace
public override int GetHashCode();
Generates a hash code for the current instance.
A Int32 containing the hash code for the current instance.
The algorithm used to generate the hash code is unspecified.[Note: This method overrides System.Object.GetHashCode .]
System.ValueType Class, System Namespace
public override string ToString();
Returns a String representation of the fully-qualified name of the type of the current instance.
A String representation of the fully-qualified name of the type of the current instance.
[Note: This method overrides System.Object.ToString.This method returns the System.Type.FullName property.
]
System.ValueType Class, System Namespace