Microsoft Visual C#
Program Language
C++ + Java = C#
C++ Quick Compiler Language
Java Platform Independent Language
The Introduction of C# 2002
C# Founder Mr.Antrus
Program.CS
File Name File Type
// Comment
Variable Naming
• Variables are containers for storing data values.
Declaring(Creating) and Initializing
Variable
• To create a variable, you must specify the type that is
declaring variable
• Assign a value to variable that is initializing variable
string name; //declaration
name = "thara"; //initialization
string town= "colombo"; // declaring and initializing variable
Data Type
Arithmetic Operators
• Operators are used to perform operations on variables and values.
Operator Name Description Example
+ Addition Adds together two values x+y
- Subtraction Subtracts one value from another x-y
* Multiplication Multiplies two values x*y
/ Division Divides one value by another x/y
% Modulus Returns the division remainder x%y
++ Increment Increases the value of a variable by 1 x++
-- Decrement Decreases the value of a variable by 1 x--
Assignment Operators
• Addition assign operator +=
• Assign operator =
Operator Example Same As
= x=5 x=5
+= x += 3 x=x+3
-= x -= 3 x=x-3
*= x *= 3 x=x*3
/= x /= 3 x=x/3
%= x %= 3 x=x%3
Comparison Operator
• Comparison operators are used to compare two values
• The return value of comparison is either true or false
Operator Name Example
== Equal to x == y
!= Not equal x != y
> Greater than x>y
< Less than x<y
>= Greater than or equal to x >= y
<= Less than or equal to x <= y
Logical Operators
• As with comparison operators, you can also test for True or
False values with logical operators.
Operator Name Description Example
&& Logical and Returns True if both statements x < 5 && x < 10
are true
|| Logical or Returns True if one of the x < 5 || x < 4
statements is true
! Logical not Reverse the result, returns False !(x < 5 && x < 10)
if the result is true
Framework Form
Check Box
Text Box Label
Radio Button
Combo Box
Date Time
Picker
Button
Label
Text Box
Button