Skip to content

Commit

Permalink
Added ToString for SafeStringMallocHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Nov 14, 2023
1 parent f1c2222 commit 75fa69f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/BUTR.NativeAOT.Shared/SafeStringMallocHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ protected override bool ReleaseHandle()
}

public ReadOnlySpan<char> ToSpan() => MemoryMarshal.CreateReadOnlySpanFromNullTerminated((char*) handle.ToPointer());

public override string ToString() => ToSpan().ToString();
}
}
#nullable restore
Expand Down

0 comments on commit 75fa69f

Please sign in to comment.