Skip to content

Commit

Permalink
docs(xml-element): add explanation documentation to MemoryWriter.TryR…
Browse files Browse the repository at this point in the history
…elease()
  • Loading branch information
LSViana committed Aug 17, 2023
1 parent c9e84b1 commit e5d8ce3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions YDotNet/Infrastructure/MemoryWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ internal static bool TryRelease(nint pointer)
return false;
}

// This method doesn't throw if called with `nint.Zero` but having a `Try*` version
// makes the API more future-friendly and easier to understand for C# developers.
//
// If they called a `TryWrite*` method, they should call a `TryRelease` method too.
// Otherwise, they should call `Release`.
Release(pointer);

return true;
Expand Down

0 comments on commit e5d8ce3

Please sign in to comment.