BlueCollar.Dashboard.StaticFile.GetContentType C# (CSharp) Метод

GetContentType() публичный статический Метод

Gets the content-type to use for files with the given extension. Expects the leading "." to be included with the extension.
public static GetContentType ( string extension ) : string
extension string The extension to get the content-type for.
Результат string
        public static string GetContentType(string extension)
        {
            if (string.IsNullOrEmpty(extension))
            {
                throw new ArgumentNullException("extension", "extension must contain a value.");
            }

            switch (extension.ToUpperInvariant())
            {
                case ".GIF":
                    return "image/gif";
                case ".PNG":
                    return "image/png";
                case ".CSS":
                    return "text/css";
                case ".JS":
                    return "text/javascript";
                case ".HTML":
                case ".XSLT":
                    return "text/html";
                default:
                    return "application/octet-stream";
            }
        }