Visual StudioIf this is the first time you have run VS, you will be presented with a list of preferences intended for users who have experience with previous releases of this development environment. The choices you make here affect a number of things, such as the layout of windows, the way that console windows run, and so on. Therefore, choose Visual C# Development Settings; otherwise, you may find that things don’t quite work as described.
The main window, which contains a helpful Start Page by default when VS is started, is where all your code is displayed. This window can contain many documents, each indicated by a tab, so you can easily switch between several files by clicking their file names. It also has other functions: It can display GUIs that you are designing for your projects, plain-text files, HTML, and various tools that are built into Visual Studio.
Above the main window are toolbar and the VS menu.
Here are brief descriptions of each of the main features that you will use the most:
- The Toolbox toolbar pops up when the mouse moves over it. It provides access to, among other things, the user interface building blocks for Windows applications.
- The Solution Explorer window displays information about the currently loaded solution.
- Properties window, not shown in Figure because it appears only when you are working on a project.
- Also not shown in the screenshot is another extremely important window: the Error List window It shows errors, warnings, and other project-related information.
CONSOLE APPLICATIONS1.Create a new console application project by selecting File ? New ? Project
2.Choose the Console Application project type,in the Name text box enter "HelloWorld"
3.Click the OK button.
static void Main(string args)
Press Ctrl+F5 to Run Your App.
Source CodeA program consists of source code that you type into a file. You compile thesource code file into IL (Microsoft Intermediate Language).You run your program and the CLR turns the IL into executable code. This is known as Just In Time compiling. The compiled code is then cached in memory.
This program illustrates many concepts in C# programming. Let’s take it apart, piece-by-piece.
The first three lines begin with the keyword using. The keyword using tells Visual C#
Express you want to use the functionality defined in the reference after the using keyword.
Namespace keyword is used to declare a scope. It could contain one or more classes.
A class is an abstraction describing the common features of all objects in a group of similar objects. For example, a class called Student could be created to describe all Student characteristics.
This means each and every Student object will have name,student Id,birth date,address ,......
A method is a function owned by your class.The member methods define what your class can do or how it behaves.
For example, a class called "Human" some of his behaviors or functions will be : walk , eat , drink , .......
Every Method have a signature
1.it's the entry point of your program
2.There is only one entry point in the C# program
3.It must be static
4.It could either have return type or not(void)
5.It could declared with or without parameters
CommentsC# supports three styles of comments:
• multiple lines /* */
• Single line //
• XML documentation comments ///
Post a Comment