Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created November 8, 2011 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yetanotherchris/1347811 to your computer and use it in GitHub Desktop.
Save yetanotherchris/1347811 to your computer and use it in GitHub Desktop.
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