Skip to content

Commit 94c8c4e

Browse files
authored
Update README.md
1 parent 24b9318 commit 94c8c4e

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

README.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,64 @@
1+
![img|300x200](https://raw.githubusercontent.com/managedcode/MimeTypes/main/logo.png)
2+
13
# MimeTypes
2-
MIME-type (Media type)
4+
5+
[![.NET](https://github.com/managedcode/MimeTypes/actions/workflows/dotnet.yml/badge.svg)](https://github.com/managedcode/MimeTypes/actions/workflows/dotnet.yml)
6+
[![Coverage Status](https://coveralls.io/repos/github/managedcode/MimeTypes/badge.svg?branch=main&service=github)](https://coveralls.io/github/managedcode/MimeTypes?branch=main)
7+
[![nuget](https://github.com/managedcode/MimeTypes/actions/workflows/nuget.yml/badge.svg?branch=main)](https://github.com/managedcode/MimeTypes/actions/workflows/nuget.yml)
8+
[![CodeQL](https://github.com/managedcode/MimeTypes/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/managedcode/MimeTypes/actions/workflows/codeql-analysis.yml)
9+
10+
| Version | Package | Description |
11+
| ------- |-------------------------------------------------------------------------------------------------------------------------------------|-----------------|
12+
|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.MimeTypes.svg)](https://www.nuget.org/packages/ManagedCode.MimeTypes) | [ManagedCode.MimeTypes](https://www.nuget.org/packages/ManagedCode.MimeTypes) | Core |
13+
14+
---
15+
16+
17+
## Motivation
18+
MIME (Multipurpose Internet Mail Extensions) types are used to specify the type of data that a file contains, such as text, images, or video. These types are often used in web development to indicate the type of content in HTTP responses.
19+
20+
Working with MIME types in C# can be cumbersome, as they are typically represented as strings. This can make it difficult to ensure the correct usage and spelling of MIME types, and can lead to errors and inconsistencies in your code.
21+
22+
Our project, MimeType, provides a convenient way to work with MIME types in C#. It defines a set of properties for each MIME type, allowing you to use properties instead of strings in your code. This makes it easy to ensure the correct usage and spelling of MIME types, and can make your code more readable and maintainable.
23+
24+
## Features
25+
Defines a set of properties for each MIME type, allowing you to use properties instead of strings in your code.
26+
Makes it easy to ensure the correct usage and spelling of MIME types.
27+
Improves the readability and maintainability of your code.
28+
29+
## Example
30+
Here's an example of how you might use the MimeType project to specify the content type of an HTTP response in C#:
31+
32+
``` csharp
33+
using ManagedCode.MimeTypes;
34+
```
35+
``` csharp
36+
// Set the content type of the response to "text/plain".
37+
response.ContentType = MimeType.TextPlain;
38+
```
39+
40+
## Installation
41+
To install the MimeType project, you can use NuGet:
42+
43+
``` csharp
44+
dotnet add package ManagedCode.MimeTypes
45+
```
46+
47+
## Usage
48+
To use the MimeType project, you will need to add a reference to the MimeType namespace in your C# code:
49+
50+
``` csharp
51+
using MimeType;
52+
```
53+
Then, you can use the properties defined by the MimeType class to specify MIME types in your code. For example:
54+
55+
``` csharp
56+
// Set the content type of the response to "application/pdf".
57+
response.ContentType = MimeHelper.PDF;
58+
59+
// Set the content type of the response to ""text/plain"".
60+
response.ContentType = MimeHelper.GetMimeType("file.txt");
61+
```
62+
63+
## Conclusion
64+
In summary, the MimeType project provides a convenient and easy-to-use way to work with MIME types in C#. Its properties make it easy to ensure the correct usage and spelling of MIME types, and can improve the readability and maintainability of your code. We hope you find it useful in your own projects!

0 commit comments

Comments
 (0)