# JournalId Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/)

## Create(IEnumerable&lt;string&gt;) {#create-system-collections-generic-ienumerable-string-0d618dbd}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/create-system-collections-generic-ienumerable-string-0d618dbd/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs)

```csharp
public static JournalId Create(IEnumerable<string> segments)
```

Creates a journal id from decoded hierarchical segments.

### Parameters

- `segments` (`IEnumerable<string>`): The id segments.

### Returns

The normalized journal id.

## Create(ReadOnlySpan&lt;string&gt;) {#create-system-readonlyspan-string-72f5f4ee}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/create-system-readonlyspan-string-72f5f4ee/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs)

```csharp
public static JournalId Create(ReadOnlySpan<string> segments)
```

Creates a journal id from decoded hierarchical segments.

### Parameters

- `segments` (`ReadOnlySpan<string>`): The id segments.

### Returns

The normalized journal id.

## Create(string, ReadOnlySpan&lt;string&gt;) {#create-string-params-system-readonlyspan-string-3ad8646b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/create-string-params-system-readonlyspan-string-3ad8646b/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L53-L60)

```csharp
public static JournalId Create(string firstSegment, params ReadOnlySpan<string> additionalSegments)
```

Creates a journal id from decoded hierarchical segments.

### Parameters

- `firstSegment` (`string`): The first id segment.
- `additionalSegments` (`ReadOnlySpan<string>`): Additional id segments.

### Returns

The normalized journal id.

## Equals(JournalId) {#equals-orleans-journaling-journalid-a7419020}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/equals-orleans-journaling-journalid-a7419020/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L121)

```csharp
public bool Equals(JournalId other)
```

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

### Parameters

- `other` (`JournalId`): 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-8b4fdcc3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/equals-object-nullable-8b4fdcc3/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L124)

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

Indicates whether this instance and a specified object are equal.

### Parameters

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

### Returns

`true` if `obj` and this instance are the same type and represent the same value; otherwise, `false`.

## FromGrainId(GrainId) {#fromgrainid-orleans-runtime-grainid-c2023cf9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/fromgrainid-orleans-runtime-grainid-c2023cf9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L37-L42)

```csharp
public static JournalId FromGrainId(GrainId grainId)
```

Creates a journal id from a grain id.

### Parameters

- `grainId` (`GrainId`): The grain id.

### Returns

The journal id.

## GetHashCode {#gethashcode-2eafd053}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/gethashcode-2eafd053/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L127)

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

Returns the hash code for this instance.

### Returns

A 32-bit signed integer that is the hash code for this instance.

## IsPrefixOf(JournalId) {#isprefixof-orleans-journaling-journalid-1253dba4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/isprefixof-orleans-journaling-journalid-1253dba4/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L103-L114)

```csharp
public bool IsPrefixOf(JournalId journalId)
```

Determines whether this id is a prefix of `journalId`.

### Parameters

- `journalId` (`JournalId`): The journal id to test.

### Returns

`true` if this id is the default value, equals `journalId`, or identifies an ancestor segment.

## ToString {#tostring-7c84c4ec}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/tostring-7c84c4ec/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L118)

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

Returns the fully qualified type name of this instance.

### Returns

The fully qualified type name.

## operator ==(JournalId, JournalId) {#op-equality-orleans-journaling-journalid-orleans-journaling-journalid-82c6f71c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/op-equality-orleans-journaling-journalid-orleans-journaling-journalid-82c6f71c/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L135)

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

Compares two journal ids for equality.

### Parameters

- `left` (`JournalId`): The first journal id.
- `right` (`JournalId`): The second journal id.

### Returns

`true` if the journal ids are equal; otherwise, `false`.

## operator !=(JournalId, JournalId) {#op-inequality-orleans-journaling-journalid-orleans-journaling-journalid-dcf5ca00}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.journaling/orleans.journaling.journalid/methods/op-inequality-orleans-journaling-journalid-orleans-journaling-journalid-dcf5ca00/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Journaling/JournalId.cs#L143)

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

Compares two journal ids for inequality.

### Parameters

- `left` (`JournalId`): The first journal id.
- `right` (`JournalId`): The second journal id.

### Returns

`true` if the journal ids are not equal; otherwise, `false`.
