Created
November 8, 2011 14:08
-
-
Save yetanotherchris/1347811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MimeType | |
{ | |
public string Extension { get; set; } | |
public string Value { get; set; } | |
public MimeType() | |
{ | |
Extension = ""; | |
Value = ""; | |
} | |
public MimeType(string extension, string value) | |
{ | |
Extension = extension; | |
Value = value; | |
} | |
public static IEnumerable Load() | |
{ | |
IList mimeTypes = new List(); | |
try | |
{ | |
using (Stream stream = typeof(MimeType).Assembly.GetManifestResourceStream("MimeTypes.mimetypes.xml")) | |
{ | |
XmlSerializer serializer = new XmlSerializer(typeof(List)); | |
mimeTypes = (IList) serializer.Deserialize(stream); | |
} | |
} | |
catch (Exception) | |
{ | |
// Re throw if you need | |
} | |
return mimeTypes; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment