C# for Java Programmers

One of Java s great features is providing a layer of abstraction for performing input/output and networking operations. The Java model for IO uses streams, something familiar to most Java programmers. C# also uses streams and provides a rich set of libraries for hiding the complications of data transfer. The counterpart of the java.io package is the System.IO namespace. Classes in the System.IO namespace allow you to read and write information to a file, or to the console. Other packages, such as System.Net.Socket, support streams for network connections.
In Java, files and directories are handled using a single class called File. This ambiguous design sometimes leads to confusion since it can be difficult to determine if a file or directory is being used. C# distinguishes between files and directories by giving us two classes to handle disk operations: File and Directory. These two classes use only static methods to perform disk operations, but there are also two corresponding classes that perform disk operations on instances: FileInfo and DirectoryInfo. For Java programmers, the latter seems more familiar.
C# uses a base class for FileInfo and DirectoryInfo called FileSystemInfo. This base class contains only methods that are common to both directories and files. Many of the methods in FileSystemInfo have counterparts in java.io.File. C# also has methods that have no counterpart in Java, since the Java strategy is to create only methods that are universal across...