2.5 Summary
You can write C# programs both from the command line and by using the Visual Studio .NET IDE. In its simplest form, a C# application is an EXE file that you create by compiling one or many class files. For the program to execute, you must define an entry point, and a C# EXE file can have only one entry point.
Java programmers should be aware of the following key points.
There is no classpath in C#. All the data required to run the EXE file is defined in the EXE file. C# allows multiple public classes in one source file. C# does not require that you give the same name to the class file that you give to the public class in that file. The Main method of C# must be static (just as in Java). C# namespaces are roughly equivalent to Java packages, but their structure has no relation to the way source files are saved on the disk. Java packages dictate the directory structure of the source files on the disk, but C# namespaces do not. In Java you can import a package or a specific class in that package (or both) in the same source file. In C# you cannot use the using keyword with classes. The using keyword can be used only on namespaces. As in Java, every C# class comes with a default no-argument public constructor (this is evident from the IL).
|