Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
AliveDevil committed Aug 28, 2024
1 parent 9001719 commit 406b9c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
10 changes: 0 additions & 10 deletions core/src/main/csharp/Windows/Win32/Foundation_PWSTR_Extensions.cs

This file was deleted.

6 changes: 4 additions & 2 deletions core/src/main/csharp/Windows/Win32/PCWSTR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ namespace Windows.Win32.Foundation;

public unsafe partial struct PCWSTR
{
public static PCWSTR DangerousFromString(in ReadOnlySpan<char> value)
public static PCWSTR DangerousFromSpan(in ReadOnlySpan<char> value)
{
return (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(value));
}

public static PCWSTR DangerousFromString(string value) => DangerousFromString(value.AsSpan());
public static PCWSTR DangerousFromString(string value) => DangerousFromSpan(value.AsSpan());

public PWSTR DangerousAsPWSTR() => Value;

public string ToString(int length) => Value is null ? new string(Value, 0, length) : null;
}
4 changes: 3 additions & 1 deletion core/src/main/csharp/Windows/Win32/PWSTR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ namespace Windows.Win32.Foundation;

public unsafe partial struct PWSTR
{
public static PWSTR DangerousFromString(in Span<char> value)
public static PWSTR DangerousFromSpan(in Span<char> value)
{
return (char*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(value));
}

public PCWSTR DangerousAsPWSTR() => Value;

public string ToString(int length) => Value is null ? null : new(Value, 0, length);
}

0 comments on commit 406b9c2

Please sign in to comment.