DevToys logo DevToys
  • Home
  • Blog
  • Documentation
  • Download
Search Results for

    Show / Hide Table of Contents

    Class OneOfExtensions

    Extension methods for working with OneOf types.

    Inheritance
    object
    OneOfExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DevToys.Api
    Assembly: DevToys.Api.dll
    Syntax
    public static class OneOfExtensions

    Methods

    GetStreamAsync(OneOf<FileInfo, string>, IFileStorage, CancellationToken)

    Gets a stream asynchronously based on the input OneOf type.

    Declaration
    public static Task<ResultInfo<Stream>> GetStreamAsync(this OneOf<FileInfo, string> input, IFileStorage fileStorage, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    OneOf<FileInfo, string> input

    The input OneOf type.

    IFileStorage fileStorage

    The file storage implementation.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<ResultInfo<Stream>>

    A task that represents the asynchronous operation. The task result contains the stream and a flag indicating if the stream was successfully retrieved.

    GetStreamAsync(OneOf<string, FileInfo>, IFileStorage, CancellationToken)

    Gets a stream asynchronously based on the input OneOf type.

    Declaration
    public static Task<ResultInfo<Stream>> GetStreamAsync(this OneOf<string, FileInfo> input, IFileStorage fileStorage, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    OneOf<string, FileInfo> input

    The input OneOf type.

    IFileStorage fileStorage

    The file storage implementation.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<ResultInfo<Stream>>

    A task that represents the asynchronous operation. The task result contains the stream and a flag indicating if the stream was successfully retrieved.

    ReadAllTextAsync(OneOf<FileInfo, string>, IFileStorage, CancellationToken)

    Reads all text asynchronously based on the input OneOf type.

    Declaration
    public static Task<ResultInfo<string>> ReadAllTextAsync(this OneOf<FileInfo, string> input, IFileStorage fileStorage, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    OneOf<FileInfo, string> input

    The input OneOf type.

    IFileStorage fileStorage

    The file storage implementation.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<ResultInfo<string>>

    A task that represents the asynchronous operation. The task result contains the text content and a flag indicating if the content was successfully read.

    ReadAllTextAsync(OneOf<string, FileInfo>, IFileStorage, CancellationToken)

    Reads all text asynchronously based on the input OneOf type.

    Declaration
    public static Task<ResultInfo<string>> ReadAllTextAsync(this OneOf<string, FileInfo> input, IFileStorage fileStorage, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    OneOf<string, FileInfo> input

    The input OneOf type.

    IFileStorage fileStorage

    The file storage implementation.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<ResultInfo<string>>

    A task that represents the asynchronous operation. The task result contains the text content and a flag indicating if the content was successfully read.

    In this article
    DevToys logo © 2024 DevToys