39
1
using System;
2
using System.IO;
3
using MimeTypeExtension;
4
using System.Collections.Generic;
5
public class Program
6
{
7
public static void Main()
8
{
9
string f = "hallo.jpg";
10
FileInfo ffi = new FileInfo(f);
11
string f_mime = ffi.MimeType();
12
Console.WriteLine(f + "=>" + f_mime );
13
14
string f1 = "hallo.wasm";
15
FileInfo f1fi = new FileInfo(f1);
16
string f1_mime = f1fi.MimeType();
17
Console.WriteLine(f1 + "=>" + f1_mime);
18
19
string f2 = "hallo.pdf";
20
FileInfo f2fi = new FileInfo(f2);
21
string f2_mime = f2fi.MimeType();
22
Console.WriteLine(f2 + "=>" + f2_mime);
23
24
var f3 = "hallo.xyzz";
25
var f3fi = new FileInfo(f3);
26
var f3_mime = f3fi.MimeType();
27
Console.WriteLine(f3 + "=>" + f3_mime);
28
f3_mime = f3fi.MimeTypeOrDefault();
29
Console.WriteLine(f3 + "=>" + f3_mime);
30
31
32
33
Uri ur = new Uri("https://localhost/guido.png");
34
string ur_mime = ur.MimeType();
35
Console.WriteLine(ur.ToString() + "=>" + ur_mime);
36
37
38
}
39
}
Cached Result
caught
Keys: 1
Values: foo,foo2
Keys: 2
Values: bar,bar2
Type: ValidationResultTimesheetIdentifier
Type: ValidationResultTimesheetDetailIdentifier