Investigating System.Object                                                                

In VB , every type (value and reference) ultimately derives from a common base class: System.Object. The
Object class defines the common polymorphic behavior for every type in the .NET universe. If you do not
specify a base class when defining a class, the compiler adds 'Inherits System.Object' automatically.


'Implicitly derived from System.Object
Class Foo
 
End Class

'Explicitly derived from System.Object
Class Bar
   Inherits System.Object
End Class























System.Object defines a set of members. Note that some of these items are declared Overridable, and therefore
can be overridden:
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
System.Object
Table of Contents
Courseware
Training Resources
Tutorials

  Method of Object Class

  Meaning in Life

  Equals()

 (Public, Overloads, Overridable)

  By default this method will return true only if the items being
  compared refer to the exact same item in memory. Thus, Equals()
  is used to compare object references, not the state of the internal
  member variables.
 
  Typically, you will override this to return true only if the items
  being compared have the same internal state values.

  If you override GetHashCode(), you should also override Equals().

  Equals()

  (Public, Overloads, Shared)

  Compares two objects and returns true if they are equal.

  ReferenceEquals()

  (Public, Shared)

  Compares two object references and returns true if they refer to
  the same instance.

  GetHashCode()

  (Public, Overridable)

  By default, returns an integer that identifies a specific object
  instance. Override to return an integer that identifies a specific
  object value.

  If you override Equals(), you should also override
  GetHashCode().

  GetType()

 (Public)

  Returns a Type object, which describes the sort of object you are
  currently referencing. In short, this is a Runtime Type
  Identification (RTTI) method available to all objects (more later).

  ToString()

  (Public, Overridable)

  Returns a string representation of this object using the
 “<namespace>.<class name>” format (termed the fully qualified
 name).  If the type has not been defined within a namespace,
 <class name> alone is returned.

 You typically override this to return a tokenized string of
 name/value pairs that represent the object’s internal state rather
 than its fully qualified name. Great for tracing purposes.

  Finalize()

  (Protected, Overridable)

  Called to free any allocated resources before the object is
  destroyed.

  MemberwiseClone()

  (Protected)

  Performs a shallow copy of the current object. In other words,
  each value field in the original is copied into the new instance.
  However, each reference field in the new instance is set to refer to
  the same object as the field in the original.
Services