Table of Contents

Method GetFileExtension

Namespace
Xunit
Assembly
xunit.v3.runner.utility.netfx.dll

GetFileExtension(string)

Gets the file extension for the given media type. If the media type is unknown, it will return .bin.

public static string GetFileExtension(string mediaType)

Parameters

mediaType string

The media type to get the file extension from

Returns

string

Remarks

This list is pre-populated with media types from https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types. On Windows, an unknown media type will attempt to find the file extension in the system registry, under HKEY_CLASSES_ROOT\MIME\Database\Content Type; on non-Windows OSes, there is no fallback. The pre-populated cache was last populated on 2025 February 5.