Introduction to Visual Studio and CSharp



Introduction to Visual Studio and C#

Hans-Petter Halvorsen

Introduction to Visual Studio and C#

Hans-Petter Halvorsen

Copyright ? 2017

E-Mail: hans.p.halvorsen@usn.no Web:



Table of Contents

1. Introduction ...................................................................................................................... 6 1.1. Visual Studio ............................................................................................................... 6 1.2. C# ................................................................................................................................ 7 1.3. .NET Framework ......................................................................................................... 7 1.4. Object-Oriented Programming (OOP) ........................................................................ 8

2. Visual Studio...................................................................................................................... 9 2.1. Introduction ................................................................................................................ 9 2.2. Getting Started ........................................................................................................... 9 2.2.1. Integrated Development Environment (IDE)....................................................... 9 2.2.2. New Project ....................................................................................................... 10 2.2.3. Solution Explorer ............................................................................................... 11 2.2.4. Toolbox .............................................................................................................. 12 2.2.5. Editors and Designers ........................................................................................ 13 2.2.6. Properties window ............................................................................................ 13 2.2.7. Build and Debug Tools ....................................................................................... 14

3. Windows Programming................................................................................................... 16 3.1. Introduction .............................................................................................................. 16 3.1.1. Windows Forms................................................................................................. 16 3.1.2. WPF ................................................................................................................... 17 3.2. Hello World............................................................................................................... 17

4. Getting Started with C# ................................................................................................... 20

3

4

Table of Contents

4.1. Introduction .............................................................................................................. 20

4.2. Data Types and Variables.......................................................................................... 20

4.2.1. Boolean type ..................................................................................................... 21

4.2.2. Numeric types: Integrals, Floating Point, Decimal ............................................ 21

4.2.3. String type ......................................................................................................... 21

4.2.4. Arrays ................................................................................................................ 22 4.3. Control Flow ............................................................................................................. 22

4.3.1. The if Statement ................................................................................................ 22

4.3.2. The switch Statement........................................................................................ 23

4.4. Loops......................................................................................................................... 24

4.4.1. The while Loop .................................................................................................. 24

4.4.2. The do Loop ....................................................................................................... 24

4.4.3. The for Loop ...................................................................................................... 25 4.4.4. The foreach Loop............................................................................................... 25

4.5. Methods ................................................................................................................... 25

4.5.1. Nonstatic Methods ............................................................................................ 26

4.5.2. Static Methods .................................................................................................. 26

4.6. Namespaces.............................................................................................................. 27

4.7. Classes ...................................................................................................................... 27

4.7.1. Constructor........................................................................................................ 28

4.8. Properties ................................................................................................................. 30

4.9. Naming Convention .................................................................................................. 32

5. More Object-oriented Techniques .................................................................................. 34

5.1. Inheritance................................................................................................................ 34

5.2. Polymorphism........................................................................................................... 35

5.3. Encapsulation ........................................................................................................... 36

Tutorial: Introduction to Visual Studio and C#

5

Table of Contents

6. Exception Handling.......................................................................................................... 37

7. Windows Forms Example ................................................................................................ 39

8. Web Programming .......................................................................................................... 45

8.1. Introduction .............................................................................................................. 45

8.2. HTML......................................................................................................................... 45

8.3. Web Browser ............................................................................................................ 45 8.4. CSS ............................................................................................................................ 46

8.5. JavaScript .................................................................................................................. 46

8.6. .................................................................................................................... 46

8.7. AJAX/ AJAX ................................................................................................. 47

8.8. Silverlight ......................................................................Error! Bookmark not defined.

9. Database Programming................................................................................................... 48

9.1. ................................................................................................................... 48

Tutorial: Introduction to Visual Studio and C#

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download