What's the .Net replacement for File.Type FileSystemObject property? -


In Classic ASP we use the property to obtain a friendly name related to a file type from the registry (for example, "text document").

I do not know about a method in BCL, but you can easily read it from the registry Are:

  using the system; Using Microsoft.Win32; Classroom Program {Static Zero Main (string [] ARG) {string extension = ".txt"; String nicename = ""; (Using the registry key key = Registry.closeSoft.OpenSuboo (extension)) {if (key! = Null) {string filetype = key.GetValue (null) string; (Registry keytype = Registry.classes.root using OpenSubUKI (file type)) {if (keyType! = Null) {nicename = keyType.GetValue (null) string; }}}} Console.WriteLine (nicename); }}  

However, the method provided by Vladimir should be preferred because it uses an API interface.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -