Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Mime Types class

I want to save a Mime Type in my code. Now I use to do this:

string mYMimeType = "text/plain";

Is there a way to save it in a (already existent) standard,dedicated class? Something like...

Http.MimeTypes myMimeType = Http.MimeTypes.TextPlain;
like image 289
Alex Avatar asked Dec 19 '17 11:12

Alex


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

Why do we write C?

We write C for Carbon Because in some element the symbol of the element is taken form its first words and Co for Cobalt beacause in some elements the symbol of the element is taken from its first second letters, so that the we don't get confuse.


1 Answers

you can make use of MediaTypeNames class exists in System.Net.Mime namesapce.

Below is .net class can help you , you dont have to create it by youself.

namespace System.Net.Mime
{
    // Summary:
    //     Specifies the media type information for an e-mail message attachment.
    public static class MediaTypeNames
    {

        // Summary:
        //     Specifies the kind of application data in an e-mail message attachment.
        public static class Application
        {
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Application data is not
            //     interpreted.
            public const string Octet = "application/octet-stream";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Application data is in
            //     Portable Document Format (PDF).
            public const string Pdf = "application/pdf";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Application data is in
            //     Rich Text Format (RTF).
            public const string Rtf = "application/rtf";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Application data is a SOAP
            //     document.
            public const string Soap = "application/soap+xml";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Application data is compressed.
            public const string Zip = "application/zip";
        }

        // Summary:
        //     Specifies the type of image data in an e-mail message attachment.
        public static class Image
        {
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Image data is in Graphics
            //     Interchange Format (GIF).
            public const string Gif = "image/gif";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Image data is in Joint
            //     Photographic Experts Group (JPEG) format.
            public const string Jpeg = "image/jpeg";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Image data is in Tagged
            //     Image File Format (TIFF).
            public const string Tiff = "image/tiff";
        }

        // Summary:
        //     Specifies the type of text data in an e-mail message attachment.
        public static class Text
        {
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Text data is in HTML format.
            public const string Html = "text/html";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Text data is in plain text
            //     format.
            public const string Plain = "text/plain";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Text data is in Rich Text
            //     Format (RTF).
            public const string RichText = "text/richtext";
            //
            // Summary:
            //     Specifies that the System.Net.Mime.MediaTypeNames.Text data is in XML format.
            public const string Xml = "text/xml";
        }
    }
}
like image 147
Pranay Rana Avatar answered Oct 12 '22 12:10

Pranay Rana