Introduction to class CSharp
With C # everything must be contained in a class. A field, a method must therefore belong to a class. This tutorial, simple and short, aims to explain the basic rules to create and use a class.
Explanations
Hello Word
C # program must include at least one class and the class must necessarily contain the static Main method which is the entry point of the program.
Here's how the program is written minimum "Hello Word" in a console application in C #:
Create and use a class
C # can obviously contain several classes. So if you delegate the message "Hello Word" Message to a class our program becomes:
In this example of the Main method does Class Program itself over the message but called the Display method of Class Message. To do this we must first create an instance of the object by Message: Message msg = new Message ();
Bookmarks