Associate file extensions in C#
I really needed a simple class to associate a file extension to my applications. That's why I created this simple static class that can associate (programmatically) an extension to my application: public static class FileAssociator { //[System.Security.Permissions.RegistryPermission(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true)] public static void AssociateExtension(string extension, string applicationPath, string identifier, string description, string icon) { RegistryKey CR = Registry.ClassesRoot; //CreateRegistryKey HKEY_CLASSES_ROOT\Extension RegistryKey extensionKey = CR.CreateSubKey(extension); //SetRegistryValue of HKEY_CLASSES_ROOT\Extension, use default value, value= Identifier extensionKey.SetValue("", identifier, RegistryValueKind.String); extensionKey.Close(); //CreateRegistryKey HKEY_CLASSES_ROOT\Identifier RegistryKey identifierKey = CR.CreateSubKey...