Skip to content

Commit

Permalink
Merge pull request #765 from davkean/AvoidStringLoad
Browse files Browse the repository at this point in the history
Avoid loading strings unless needed
  • Loading branch information
AArnott authored Jul 22, 2024
2 parents cdef1c7 + abe0983 commit 86a8985
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Nerdbank.Streams/MultiplexingStream.Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@ public bool FaultOpenChannelsOnStreamDisposal
/// <returns>This instance if already frozen, otherwise a frozen copy.</returns>
public Options GetFrozenCopy() => this.IsFrozen ? this : new Options(this, frozen: true);

private void ThrowIfFrozen() => Verify.Operation(!this.IsFrozen, Strings.Frozen);
private void ThrowIfFrozen()
{
// Avoid loading string unless needed
if (this.IsFrozen)
{
Verify.FailOperation(Strings.Frozen);
}
}
}
}
}

0 comments on commit 86a8985

Please sign in to comment.