File System File System
File System File System
DocFX + Singulink = ♥

Search Results for

    Method GetMultiExtension

    GetMultiExtension(params ReadOnlySpan<string>)

    Gets the longest of the known multi-extensions, which have one or more parts (e.g. ".gz" or ".tar.gz"), that the file name ends with, otherwise Extension. Case is ignored on every platform.

    Declaration
    string GetMultiExtension(params ReadOnlySpan<string> knownExtensions)
    Parameters
    Type Name Description
    ReadOnlySpan<string> knownExtensions

    The known multi-extensions. Each one is shaped as described for the extension of HasMultiExtension(string).

    Returns
    Type Description
    string

    The longest matching known extension as it was passed in (the first one if several match with the same length), otherwise Extension, which is an empty string if the file name has no extension.

    Remarks

    For example, with ".tar.gz" and ".tar.bz2", "backup.tar.gz" gives ".tar.gz" and "photo.jpg" gives ".jpg".

    The result can be passed to RemoveMultiExtension(string, PathOptions), which leaves a file name without an extension unchanged.

    Exceptions
    Type Condition
    ArgumentException

    A known extension is null or empty, isn't shaped as described for HasMultiExtension(string) or has a character that names can't have in the path format.

    © Singulink. All rights reserved.