# GuidId Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/)

## CompareTo(GuidId?) {#compareto-orleans-runtime-guidid-nullable-ee41ca6b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/compareto-orleans-runtime-guidid-nullable-ee41ca6b/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L63)

```csharp
public int CompareTo(GuidId? other)
```

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

### Parameters

- `other` (`GuidId?`): An object to compare with this instance.

### Returns

A value that indicates the relative order of the objects being compared. The return value has these meanings: 

| Value | Meaning |
| --- | --- |
| Less than zero | This instance precedes `other` in the sort order. |
| Zero | This instance occurs in the same position in the sort order as `other`. |
| Greater than zero | This instance follows `other` in the sort order. |

## Equals(GuidId?) {#equals-orleans-runtime-guidid-nullable-79f18cef}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/equals-orleans-runtime-guidid-nullable-79f18cef/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L66)

```csharp
public bool Equals(GuidId? other)
```

Indicates whether the current object is equal to another object of the same type.

### Parameters

- `other` (`GuidId?`): An object to compare with this object.

### Returns

`true` if the current object is equal to the `other` parameter; otherwise, `false`.

## Equals(object?) {#equals-object-nullable-3ba842a1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/equals-object-nullable-3ba842a1/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L69)

```csharp
public override bool Equals(object? obj)
```

Determines whether the specified object is equal to the current object.

### Parameters

- `obj` (`object?`): The object to compare with the current object.

### Returns

`true` if the specified object is equal to the current object; otherwise, `false`.

## GetGuidId(Guid) {#getguidid-system-guid-a21c603d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/getguidid-system-guid-a21c603d/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L49)

```csharp
public static GuidId GetGuidId(Guid guid)
```

Returns a [GuidId](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/) instance corresponding to the provided [GuidId](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/).

### Parameters

- `guid` (`Guid`): The guid.

### Returns

A [GuidId](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/) instance corresponding to the provided [GuidId](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/).

## GetHashCode {#gethashcode-1e900197}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/gethashcode-1e900197/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L72)

```csharp
public override int GetHashCode()
```

Serves as the default hash function.

### Returns

A hash code for the current object.

## GetNewGuidId {#getnewguidid-ebed1a01}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/getnewguidid-ebed1a01/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L39)

```csharp
public static GuidId GetNewGuidId()
```

Returns a new, randomly generated [GuidId](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/).

### Returns

A new, randomly generated [GuidId](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/).

## GetObjectData(SerializationInfo, StreamingContext) {#getobjectdata-system-runtime-serialization-serializationinfo-system-runtime-seri-851cc5b8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/getobjectdata-system-runtime-serialization-serializationinfo-system-runtime-seri-851cc5b8/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L96-L97)

```csharp
public void GetObjectData(SerializationInfo info, StreamingContext context)
```

Populates a `System.Runtime.Serialization.SerializationInfo` with the data needed to serialize the target object.

### Parameters

- `info` (`SerializationInfo`): The `System.Runtime.Serialization.SerializationInfo` to populate with data.
- `context` (`StreamingContext`): The destination (see `System.Runtime.Serialization.StreamingContext`) for this serialization.

### Exceptions

- `System.Security.SecurityException`: The caller does not have the required permission.

## ToString {#tostring-aeab0620}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/tostring-aeab0620/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L75)

```csharp
public override string ToString()
```

Returns a string that represents the current object.

### Returns

A string that represents the current object.

## operator ==(GuidId?, GuidId?) {#op-equality-orleans-runtime-guidid-nullable-orleans-runtime-guidid-nullable-18d39876}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/op-equality-orleans-runtime-guidid-nullable-orleans-runtime-guidid-nullable-18d39876/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L83)

```csharp
public static bool operator ==(GuidId? left, GuidId? right)
```

Compares the provided operands for equality.

### Parameters

- `left` (`GuidId?`): The left operand.
- `right` (`GuidId?`): The right operand.

### Returns

`true` if the provided values are equal, otherwise `false`.

## operator !=(GuidId?, GuidId?) {#op-inequality-orleans-runtime-guidid-nullable-orleans-runtime-guidid-nullable-d8ef5ba2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.guidid/methods/op-inequality-orleans-runtime-guidid-nullable-orleans-runtime-guidid-nullable-d8ef5ba2/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/IDs/GuidId.cs#L91)

```csharp
public static bool operator !=(GuidId? left, GuidId? right)
```

Compares the provided operands for inequality.

### Parameters

- `left` (`GuidId?`): The left operand.
- `right` (`GuidId?`): The right operand.

### Returns

`true` if the provided values are not equal, otherwise `false`.
