From a69fa7a7bceee799e75b0521365f6d4d9dd27cdc Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 3 Jul 2021 14:45:51 -0400 Subject: [PATCH] Update README.md easier example --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ac4839..fbfcbeb 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,9 @@ using MimeTypes; ### Getting the mime type to an extension ```cs -Console.WriteLine("txt -> " + MimeTypeMap.GetMimeType("txt")); // "text/plain" +var fileName = "test.txt"; +var ext = Path.GetExtension(fileName); // .txt +Console.WriteLine("txt -> " + MimeTypeMap.GetMimeType(ext)); // "text/plain" ``` Pass in a string extension and get a mime type back. Optionally include the period. If not it will be added before looking up the mime type.