| ObjectId Structure | 
Namespace: MongoDB.Bson
 Syntax
SyntaxThe ObjectId type exposes the following members.
 Constructors
Constructors| Name | Description | |
|---|---|---|
|  | ObjectId(Byte) | 
            Initializes a new instance of the ObjectId class.
             | 
|  | ObjectId(String) | 
            Initializes a new instance of the ObjectId class.
             | 
|  | ObjectId(DateTime, Int32, Int16, Int32) | Obsolete. 
            Initializes a new instance of the ObjectId class.
             | 
|  | ObjectId(Int32, Int32, Int16, Int32) | Obsolete. 
            Initializes a new instance of the ObjectId class.
             | 
 Properties
Properties| Name | Description | |
|---|---|---|
|  | CreationTime | 
            Gets the creation time (derived from the timestamp).
             | 
|   | Empty | 
            Gets an instance of ObjectId where the value is empty.
             | 
|  | Increment | Obsolete. 
            Gets the increment.
             | 
|  | Machine | Obsolete. 
            Gets the machine.
             | 
|  | Pid | Obsolete. 
            Gets the PID.
             | 
|  | Timestamp | 
            Gets the timestamp.
             | 
 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.
             | 
 Operators
Operators| Name | Description | |
|---|---|---|
|   | Equality | 
            Compares two ObjectIds.
             | 
|   | GreaterThan | 
            Compares two ObjectIds.
             | 
|   | GreaterThanOrEqual | 
            Compares two ObjectIds.
             | 
|   | Inequality | 
            Compares two ObjectIds.
             | 
|   | LessThan | 
            Compares two ObjectIds.
             | 
|   | LessThanOrEqual | 
            Compares two ObjectIds.
             | 
 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