System Library Common Framework
Search Results for

    *.Benchmark*,*.Tests*,*.ApiTests*,*.BaseTest*,DelegateJsonConverter,CalleeCancelledRequestException,ClientResponse,ContentType,OutputCachePolicy
    Show / Hide Table of Contents Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Framework.Extensions SystemLibrary.Common.Framework.Net.dll

    Extension methods for ReadOnlySpan

    ReadOnlySpanExtensions

    public static class ReadOnlySpanExtensions

    Inheritance
    object
    ReadOnlySpanExtensions
    Examples
    Arguments
    X

    Methods

    Converts the ReadOnlySpan of Char to a byte array

    public static byte[] GetBytes(this ReadOnlySpan<char> span, Encoding encoding = null)

    X
    var textSpan = "Hello World".AsSpan();
    
    var bytes = textSpan.GetBytes();
    X
    Methods arguments
    Type Name Description
    ReadOnlySpan<char> span
    Encoding encoding
    X
    Type Description
    byte[]

    Byte array or null if input was so

    Checks if span is null or length is 0

    public static bool IsNot<T>(this ReadOnlySpan<T> span)

    X
    var textSpan = "Hello World".AsSpan();
    
    var isSpan = textSpan.IsNot(); // False, as span is not null, and has text length > 0
    X
    Generic types
    Name Description
    T
    Methods arguments
    Type Name Description
    ReadOnlySpan<T> span
    X
    Type Description
    bool

    True or false

    Checks if span is not null and length is larger than 0

    public static bool Is<T>(this ReadOnlySpan<T> span)

    X
    var textSpan = "Hello World".AsSpan();
    
    var isSpan = textSpan.Is(); // True, span is not null
    X
    Generic types
    Name Description
    T
    Methods arguments
    Type Name Description
    ReadOnlySpan<T> span
    X
    Type Description
    bool

    True or false

    Convert a ReadOnlySpan of char to Base64

    public static string ToBase64(this ReadOnlySpan<char> span, Encoding encoding = null)

    X
    var textSpan = "Hello World".AsSpan();
    
    var base64 = textSpan.ToBase64();
    X
    Methods arguments
    Type Name Description
    ReadOnlySpan<char> span
    Encoding encoding
    X
    Type Description
    string

    Base64 string or null if input was so

    }

    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Framework