public static string GetFileContentType(string filename)
{
string[] array = filename.Split('.');
string result = string.Empty;
string suffix="."+array[array.Length-1];
RegistryKey rg = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(suffix);
object obj=rg.GetValue("Content Type");
result =obj!=null?obj.ToString():string.Empty;
rg.Close();
return result;
}
转载于:https://www.cnblogs.com/deadshot123/archive/2007/03/20/681455.html