213x Filetype PDF File size 1.66 MB Source: researchdesignlab.com
C# Tutorial
Table of Contents
OVERVIEW ..................................................................................................................................................... 4
Getting started .............................................................................................................................................. 4
CREATING NEW PROJECT .............................................................................................................................. 4
TOOLBOX ....................................................................................................................................................... 6
PROPERTIES WINDOW .................................................................................................................................. 8
BUILD AND DEBUGGING TOOL ..................................................................................................................... 9
BUILD MENU: ............................................................................................................................................ 9
DEBUG MENU: ........................................................................................................................................ 10
WINDOWS PROGRAMMING ....................................................................................................................... 10
HELLO WORLD ......................................................................................................................................... 10
DATA TYPES AND VERIABLES ...................................................................................................................... 12
BOOLEAN TYPES ...................................................................................................................................... 12
Numeric types: Integrals, Floating Point, Decimal .................................................................................. 13
String type ................................................................................................................................................... 13
Arrays ...................................................................................................................................................... 13
CONTROL FLOW .......................................................................................................................................... 14
The if Statement ..................................................................................................................................... 14
The switch Statement ............................................................................................................................. 15
LOOPS .......................................................................................................................................................... 16
The while Loop ........................................................................................................................................ 16
The do Loop ............................................................................................................................................ 17
The for Loop ................................................................................................................................................ 17
OUTPUT: ...................................................................................................................................................... 18
The foreach Loop .................................................................................................................................... 18
SERIAL COMMUNICATION .......................................................................................................................... 19
Setting Up................................................................................................................................................ 19
OUTPUT: ...................................................................................................................................................... 24
USB RFID INTERFACE WITH C# .................................................................................................................... 25
www.reserachdesignlab.com Page 2
C# Tutorial
Reading USB RFID data from serial port ................................................................................................. 25
FT245 RELAY CONTROLLER ......................................................................................................................... 39
GSM INERFACE ............................................................................................................................................ 43
AT Commands ............................................................................................................................................. 44
www.reserachdesignlab.com Page 3
C# Tutorial
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:
Modern, general-purpose programming language.
Object oriented.
Component oriented.
Easy to learn.
Structured language.
It produces efficient programs.
It can be compiled on a variety of computer platforms.
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.
CREATING NEW PROJECT
The first thing you do when you want to create a new application is to create a NEW PROJECT.
This can be done from start page.
www.reserachdesignlab.com Page 4
no reviews yet
Please Login to review.