| ObjectId Methods | 
The ObjectId type exposes the following members.
 Methods
Methods| Name | Description | |
|---|---|---|
|  | CompareTo | 
            Compares this ObjectId to another ObjectId.
             | 
|  | Equals(Object) | 
            Compares this ObjectId to another object.
            (Overrides ValueTypeEquals(Object).) | 
|  | Equals(ObjectId) | 
            Compares this ObjectId to another ObjectId.
             | 
|   | GenerateNewId | 
            Generates a new ObjectId with a unique value.
             | 
|   | GenerateNewId(DateTime) | 
            Generates a new ObjectId with a unique value (with the timestamp component based on a given DateTime).
             | 
|   | GenerateNewId(Int32) | 
            Generates a new ObjectId with a unique value (with the given timestamp).
             | 
|  | GetHashCode | 
            Gets the hash code.
            (Overrides ValueTypeGetHashCode.) | 
|  | GetType | Gets the Type of the current instance.(Inherited from Object.) | 
|   | Pack | Obsolete. 
            Packs the components of an ObjectId into a byte array.
             | 
|   | Parse | 
            Parses a string and creates a new ObjectId.
             | 
|  | ToByteArray | 
            Converts the ObjectId to a byte array.
             | 
|  | ToByteArray(Byte, Int32) | 
            Converts the ObjectId to a byte array.
             | 
|  | ToString | 
            Returns a string representation of the value.
            (Overrides ValueTypeToString.) | 
|   | TryParse | 
            Tries to parse a string and create a new ObjectId.
             | 
|   | Unpack | Obsolete. 
            Unpacks a byte array into the components of an ObjectId.
             | 
 Extension Methods
Extension Methods| Name | Description | |
|---|---|---|
|  | ToBson | 
            Serializes an object to a BSON byte array.
            (Defined by BsonExtensionMethods.) | 
|  | ToBsonDocument | 
            Serializes an object to a BsonDocument.
            (Defined by BsonExtensionMethods.) | 
|  | ToJson | 
            Serializes an object to a JSON string.
            (Defined by BsonExtensionMethods.) | 
 See Also
See Also