Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 public static string?GetString(this ReadOnlySpan <ushort> span)
 => span.GetPointer() != null ? new string(span.As <ushort, char>()) : null;
Пример #4
0
 public static string?GetString(this ReadOnlySpan <sbyte> span)
 => span.GetPointer() != null?Encoding.UTF8.GetString(span.As <sbyte, byte>()) : null;