17-09-2016, 10:15 AM
1455028114-4ChannelRelayBoard.docx (Size: 459.47 KB / Downloads: 8)
OVERVIEW
C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by Ecma and ISO.C# was developed by Anders Hejlsberg and his team during the development of .Net Framework.
C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high-level languages to be used on different computer platforms and architectures. The following reasons make C# a widely used professional language:
1. Modern, general-purpose programming language.
2. Object oriented.
3. Component oriented.
4. Easy to learn.
5. Structured language.
6. It produces efficient programs.
7. It can be compiled on a variety of computer platforms.
8. Part of .Net Framework.
GETTING STARTED
Creating a new visual studio C# project:
Once Visual Studio is running the first step is to create a new project. Do this by selecting New Project from the File menu. This will cause the New Project window to appear containing a range of different types of project. For the purposes of this tutorial we will be developing a Windows Forms Application so make sure that this option is selected.
DATA TYPES AND VERIABLES
“Variables” are simply storage locations for data. You can place data into them and retrieve their contents as part of a C# expression. The interpretation of the data in a variable is controlled through “Types”.
The C# simple types consist of:
1. Boolean type
2. Numeric types: Integrals, Floating Point, Decimal
3. String type
BOOLEAN TYPES
Boolean types are declared using the keyword “bool”. They have two values: “true” or “false”. In other languages, such as C and C++, boolean conditions can be satisfied where 0 means false and anything else means true. However, in C# the only values that satisfy aboolean condition is true and false, which are official keywords.
CONTROL FLOW
To be able to control the flow in your program is important in every programming language.
The two most important techniques are:
1. The if Statement
2. The switch Statement
THE IF STATEMENT
The if statement is probably the most used mechanism to control the flow in your application. An if statement allows you to take different paths of logic, depending on a given condition. When the condition evaluates to a Boolean true, a block of code for that true condition will execute. You have the option of a single if statement, multiple else if statements, and an optional else statement.