Category Archive for: Manipulating Files and the Registry

Reading and Writing to Isolated Storage

In addition to being able to read and write to and from the registry, another option is reading and writing values to and from what is called isolated storage. If you are having issues writing to the registry or to disk in general, then isolated storage is where you should turn, You can use isolated storage to…

Read More →

Reading and Writing to the-Registry

In all versions of Windows since Windows 95, the registry has been the central repository for all configuration information relating to Windows setup, user preferences, and installed software and devices, Almost all commercial software these days uses the registry to store information about itself, and COM components must place information about themselves in the registry in order to…

Read More →

File Security

When the .NET Framework 1.0/1.1 was first introduced, it didn’t come with a way to easily access and work access control lists (ACLs) for files, directories, and registry keys to do such things at that timeusually meant some work with COM interop, thus also requiring a more advanced programming knowledge of working with ACLs. This has…

Read More →

Reading and Writing to Text Files

Theoretically, it is perfectly possible to use the FileStream class to read in and display text files. You have, after all, just done that. The format in which the Default. aspx file is displayed in the preceding example is not particularly user-friendly, but that has nothing to do with any intrinsic problem with the FileStream class, only with…

Read More →

Reading and Writing to Binary Flies Using FileStream

Reading and writing to and from binary files can be done using the FileStream class. (Note that if you are working with the .NET Framework 1.x, this will most likely be the case.) The FileStream Class A FileStrearn instance is used to read or write data to or from a file. In order to construct a FileStream,…

Read More →

Buffered Streams

For performance reasons, when you read or write to or from a file, the output is buffered, This means that if your program asks for the next 2 bytes of a file stream, and the stream passes the request on to Windows, then Windows will not go through the trouble of connecting to the file system and then’ locating…

Read More →

Moving, Copying, and Deleting Files

As mentioned, moving and deleting files or folders is done by the MoveTo() and Delete () methods of the Filelnfo and Directorylnfo classes. The equivalent methods on the File and Directory classes are Move() and Delete ( ). The Filelnfo and File classes also implement the methods copyTo () and Copy ( ), respectively. However, no methods…

Read More →

The Path Class

The Path class is not a class that you would instantiate. Rather, it exposes some static methods that make operations on path names easier. For example, suppose that you want to display the full path name  or a file, ReadMe.txt in the folder C: \My Documents. You could find the path to the file using the following…

Read More →

.NET Classes That Represent Flies and Folders

Youwill notice from the previous list that two classes are used to represent a folder and two classes are used to represent a file, which one of these classes you use depends largely on how many times you need to access that folder or file: ¤ Directory and File contain only static methods and are never instantiated. You…

Read More →

Managing the File System

The classes that are used to browse around the file system and perform operations such as moving, copying, and deleting files are shown. The following list explains the function of these classes: ¤ System.MarshalByRefObject-This is the base object class for .NET classes that are remotable; permits marshaling of data between application domains. ¤ FileSystemlnfo – This is…

Read More →

Back to Top