c# programming hands on lab v1

21
C# Programming Guide Mr.Suttipong Kullawattana

Upload: suttipong-kullawattana

Post on 20-Mar-2017

37 views

Category:

Education


3 download

TRANSCRIPT

Page 1: C# programming Hands On Lab V1

C# Programming Guide

Mr.Suttipong Kullawattana

Page 2: C# programming Hands On Lab V1

To create and run a console application• Start Visual Studio.• On the menu bar, choose File, New, Project.• The New Project dialog box opens.• Expand Installed, expand Templates, expand Visual C#, and then choose Console

Application.• In the Name box, specify a name for your project, and then choose the OK button.• The new project appears in Solution Explorer.• If Program.cs isn't open in the Code Editor, open the shortcut menu

for Program.cs in Solution Explorer, and then choose View Code.• Replace the contents of Program.cs with the following code.

Page 3: C# programming Hands On Lab V1

Choose the F5 key to run the project. A Command Prompt window appears that contains the line Hello World!

Page 4: C# programming Hands On Lab V1

Comment

Page 5: C# programming Hands On Lab V1

Main Method

Page 6: C# programming Hands On Lab V1

Input & Output

Page 7: C# programming Hands On Lab V1

General Structure of a C# Program

Page 8: C# programming Hands On Lab V1

Classes (C# Programming Guide)

Page 9: C# programming Hands On Lab V1
Page 10: C# programming Hands On Lab V1
Page 11: C# programming Hands On Lab V1
Page 12: C# programming Hands On Lab V1

Structs (C# Programming Guide)

Page 13: C# programming Hands On Lab V1

Namespaces

Page 14: C# programming Hands On Lab V1

Interfaces

Page 15: C# programming Hands On Lab V1

Interfaces

Page 16: C# programming Hands On Lab V1
Page 17: C# programming Hands On Lab V1
Page 18: C# programming Hands On Lab V1
Page 19: C# programming Hands On Lab V1

How to: Implement Interface Events

An interface can declare an event. The following example shows how to implement interface events in a class. Basically the rules are the same as when you implement any interface method or property.

To implement interface events in a class• Declare the event in your class and then invoke it in the appropriate areas.

Page 20: C# programming Hands On Lab V1
Page 21: C# programming Hands On Lab V1