Table of Contents

Class MimeMapping

Namespace
Icy.Assets
Assembly
IcyUI.dll

Provides utilities for mapping file names and extensions to MIME-types.

public static class MimeMapping
Inheritance
MimeMapping
Inherited Members

Properties

FallbackMimeType

Gets or sets the fallback MIME-type. Defaults to application/octet-stream.

public static string FallbackMimeType { get; set; }

Property Value

string

Methods

GetMimeType(string)

Gets the MIME-type for the given file name, or FallbackMimeType if a mapping doesn't exist.

public static string GetMimeType(string fileName)

Parameters

fileName string

The name of the file.

Returns

string

The MIME-type for the given file name.

GetMimeTypeExtensions(string)

Attempts to fetch all available file extensions for a MIME-type.

public static IEnumerable<string> GetMimeTypeExtensions(string mimeType)

Parameters

mimeType string

The name of the MIME-type.

Returns

IEnumerable<string>

All available extensions for the given MIME-type.

TryGetMimeType(string?, out string?)

Tries to get the MIME-type for the given file name.

public static bool TryGetMimeType(string? fileName, out string? mimeType)

Parameters

fileName string

The name of the file.

mimeType string

The MIME-type for the given file name.

Returns

bool

true if a MIME-type was found, false otherwise.