public static string?GetString(this ReadOnlySpan <ushort> span) { string?result; if (span.GetPointer() != null) { result = new string(span.As <ushort, char>()); } else { result = null; } return(result); }
public static string?GetString(this ReadOnlySpan <sbyte> span) { string?result; if (span.GetPointer() != null) { result = Encoding.UTF8.GetString(span.As <sbyte, byte>()); } else { result = null; } return(result); }
public static string?GetString(this ReadOnlySpan <ushort> span) => span.GetPointer() != null ? new string(span.As <ushort, char>()) : null;
public static string?GetString(this ReadOnlySpan <sbyte> span) => span.GetPointer() != null?Encoding.UTF8.GetString(span.As <sbyte, byte>()) : null;