Skip to content

Commit dbf44c7

Browse files
Andreas Gehrkechristianhelle
Andreas Gehrke
authored andcommitted
Ctor on EventStreamId to clone an existing EventStreamId
Prevents `string[] parts` allocation, and subsequent `string.Join()`
1 parent 10feb8c commit dbf44c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Atc.Cosmos.EventStore.Cqrs/EventStreamId.cs

+10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ public EventStreamId(params string[] parts)
1616
Value = string.Join(PartSeperator, parts);
1717
}
1818

19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="EventStreamId"/> class from an existing <see cref="EventStreamId"/>.
21+
/// </summary>
22+
/// <param name="existing">The existing <see cref="EventStreamId"/>.</param>
23+
public EventStreamId(EventStreamId existing)
24+
{
25+
Parts = existing.Parts;
26+
Value = existing.Value;
27+
}
28+
1929
public IReadOnlyList<string> Parts { get; }
2030

2131
public string Value { get; }

0 commit comments

Comments
 (0)