SlideShare a Scribd company logo
Page 1 of 8
 The first line of the program using System; the using keyword is used to include the System namespace
in the program. A program generally has multiple using statements.
 The next line has the namespace declaration. A namespace is a collection of classes. The “Hello World”
Application namespace contains the class Hello World.
 The next line has a class declaration, the class Hello World contains the data and method definitions that
your program uses. Classes generally would contain more than one method. Methods define the behavior
of the class. However, the Hello World class has only one method Main.
 The next line defines the Main method, which is the entry point for all C# programs. The Main method
states what the class will do when executed
 The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the
program.
 The Main method specifies its behavior with the statement Console.WriteLine("Hello World");
WriteLine is a method of the Console class defined in the System namespace. This statement causes the
message "Hello, World!" to be displayed on the screen.
 The last line Console.ReadKey(); is for the VS.NET Users. This makes the program wait for a key press
and it prevents the screen from running and closing quickly when the program is launched from Visual
Studio .NET.
Its worth to naote the following points:
 C# is case sensitive.
 All statements and expression must end with a semicolon (;).
 The program execution starts at the main method.
 Unlike Java, file name could be different from the class name.
C# Type Conversion Methods: C# provides the following built-in type conversion methods:
Page 2 of 8
S.N Methods & Description
1
ToBoolean
Converts a type to a Boolean value, where possible.
2
ToByte
Converts a type to a byte.
3
ToChar
Converts a type to a single Unicode character, where possible.
4
ToDateTime
Converts a type (integer or string type) to date-time structures.
5
ToDecimal
Converts a floating point or integer type to a decimal type.
6
ToDouble
Converts a type to a double type.
7
ToInt16
Converts a type to a 16-bit integer.
8
ToInt32
Converts a type to a 32-bit integer.
9
ToInt64
Converts a type to a 64-bit integer.
10
ToSbyte
Converts a type to a signed byte type.
11
ToSingle
Converts a type to a small floating point number.
12
ToString
Converts a type to a string.
13
ToType
Converts a type to a specified type.
14
ToUInt16
Converts a type to an unsigned int type.
15
ToUInt32
Converts a type to an unsigned long type.
16
ToUInt64
Converts a type to an unsigned big integer.
Page 3 of 8
Accepting Values from User:
The Console class in the System namespace provides a function ReadLine() for accepting input from the user and store it into a
variable.
Arithmetic Operators:
Operator Description Example
+ Adds two operands A + B will give 30
- Subtracts second operand from the first A - B will give -10
* Multiplies both operands A * B will give 200
/ Divides numerator by de-numerator B / A will give 2
% Modulus Operator and remainder of after an integer division B % A will give 0
++ Increment operator increases integer value by one A++ will give 11
-- Decrement operator decreases integer value by one A-- will give 9
Relational Operators:
Operator Description Example
== Checks if the values of two operands are equal or not, if yes then condition becomes true.
(A == B)
is not
true.
!=
Checks if the values of two operands are equal or not, if values are not equal then condition
becomes true.
(A != B)
is true.
>
Checks if the value of left operand is greater than the value of right operand, if yes then
condition becomes true.
(A > B)
is not
true.
<
Checks if the value of left operand is less than the value of right operand, if yes then condition
becomes true.
(A < B)
is true.
>=
Checks if the value of left operand is greater than or equal to the value of right operand, if yes
then condition becomes true.
(A >= B)
is not
true.
<=
Checks if the value of left operand is less than or equal to the value of right operand, if yes
then condition becomes true.
(A <= B)
is true.
Logical Operators:
Page 4 of 8
Operator Description Example
&& Called Logical AND operator. If both the operands are non zero then condition becomes true.
(A && B)
is false.
||
Called Logical OR Operator. If any of the two operands is non zero then condition becomes
true.
(A || B)
is true.
!
Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is
true then Logical NOT operator will make false.
!(A &&
B) is
true.
Conditions:
Statement Description
if statement
An if statement consists of a boolean expression followed by one or more
statements.
if...else statement
An if statement can be followed by an optional else statement, which
executes when the boolean expression is false.
nested if statements
You can use one if or else if statement inside another if or else
if statement(s).
switch statement
A switch statement allows a variable to be tested for equality against a list of
values.
nested switch statements You can use one switch statement inside another switchstatement(s).
C# - Loops: A loop statement allows us to execute a statement or group of statements multiple times .
Loop Type Description
while loop
Repeats a statement or group of statements while a given condition is true. It tests
the condition before executing the loop body.
for loop
Executes a sequence of statements multiple times and abbreviates the code that
manages the loop variable.
do...while loop Like a while statement, except that it tests the condition at the end of the loop body
nested loops You can use one or more loop inside any another while, for or do..while loop.
Loop Control Statements:
Page 5 of 8
Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that
were created in that scope are destroyed.
Control Statement Description
break statement
Terminates the loop or switch statement and transfers execution to the statement
immediately following the loop or switch.
continue statement
Causes the loop to skip the remainder of its body and immediately retest its
condition prior to reiterating.
C# - Arrays:
An array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it
is often more useful to think of an array as a collection of variables of the same type.
Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as
numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is
accessed by an index.
Declaring Arrays:
To declare an array in C#, you can use the following syntax:
datatype[] arrayName;
where,
 datatype is used to specify the type of elements to be stored in the array.
 [ ] specifies the rank of the array. The rank specifies the size of the array.
 arrayName specifies the name of the array.
For example,
double[] balance;
Initializing an Array
Array is a reference type, so you need to use the new keyword to create an instance of the array.
For example,
double[] balance = new double[10];
Page 6 of 8
Code Description
abstract The abstract modifier can be used with classes, methods, properties, indexers, and events.
as The as operator is used to perform conversions between compatible types.
base The base keyword is used to access members of the base class from within a derived class
bool
The bool keyword is an alias of System.Boolean. It is used to declare variables to store the
Boolean values, true and false.
break The keyword break is used to exit out of a loop or switch block.
byte It represents an 8-bit unsigned integer whose value ranges from 0 to 255.
case case is often used in a switch statement.
catch The keyword catch is used to identify a statement or statement block for execution
char It represents a Unicode character whose from 0 to 65,535.
checked
The checked keyword is used to control the overflow-checking context for integral-type
arithmetic operations and conversions.
class The class keyword is used to declare a class.
const
The const keyword is used in field and local variable declarations to make the
variable constant
continue Its affect is to end the current loop and proceed to the next one.
decimal The decimal keyword denotes a 128-bit data type.
default The default keyword can be used in the switch statement
delegate
The delegate keyword is used to declare a delegate. A delegate is a programming construct
that is used to obtain a callable reference to a method of a class.
do
The do statement executes a statement or a block of statements repeatedly until a specified
expression evaluates to false.
double The double keyword denotes a simple type that stores 64-bit floating-point values.
else
An else clause immediately follows an if-body. It provides code to execute when
the condition is false.
enum
The enum keyword is used to declare an enumeration, a distinct type consisting of a set of
named constants called the enumerator list.
event It is used to declare an event.
explicit The explicit keyword is used to declare an explicit user-defined type conversion operator
extern
Use the extern modifier in a method declaration to indicate that the method is implemented
externally.
false The false keyword is a boolean constant value
finally The finally block is useful for cleaning up any resources allocated in the try block.
fixed Prevents relocation of a variable by the garbage collector.
float The float keyword denotes a simple type that stores 32-bit floating-point values.
for
The for loop executes a statement or a block of statements repeatedly until a specified
expression evaluates to false.
foreach
The foreach statement repeats a group of embedded statements for each element in an array
or an object collection.
Page 7 of 8
goto The goto statement transfers the program control directly to a labeled statement.
if
The if statement selects a statement for execution based on the value of a Boolean
expression.
implicit The implicit keyword is used to declare an implicit user-defined type conversion operator.
in The in keyword identifies the collection to enumerate in a foreach loop.
int The int keyword denotes an integral type that stores values according to the size and range
interface
The interface keyword is used to declare an interface. Interfaces provide a construct for a
programmer to create types that can have methods, properties, delegates, events, and
indexers declared, but not implemented.
internal
The internal keyword is an access modifier for types and type members. That is, it is
only visible within the assembly that implements it.
is
The is operator is used to check whether the run-time type of an object is compatible with a
given type. Using is on a null variable always returns false.
lock
The lock keyword marks a statement block as a critical section by obtaining the mutual-
exclusion lock for a given object, executing a statement, and then releasing the lock.
long
The long keyword denotes an integral type that stores values according to the size and
range.That is, it represents a 64-bit signed integer whose value ranges from -
9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
namespace
The namespace keyword is used to supply a namespace for class, structure, and type
declarations.
new In C#, the new keyword can be used as an operator or as a modifier.
null
The null keyword is a literal that represents a null reference, one that does not refer to any
object.
object It represents the base class from which all other reference types derive.
operator The operator keyword is used to declare an operator in a class or struct declaration.
out
The out method parameter keyword on a method parameter causes a method to refer to the
same variable that was passed into the method
override Use the override modifier to modify a method, a property, an indexer, or an event.
params
The keyword params is used to describe when a grouping of parameters are passed to a
method, but the number of parameters are not important, as they may vary.
private
To make the field, method, or property private to its enclosing class. That is, it is
not visible outside of its class.
protected
To make the field, method, or property protected to its enclosing class. That is, it is
not visible outside of its class.
public
To make the field, method, or property public to its enclosing class. That is, it is visible from
any class.
readonly The readonly keyword is a modifier that you can use on fields.
ref
The ref keyword explicitely specifies that a variable should be passed by reference rather
than by value.
return The return statement terminates execution of the method in which it appears and returns
Page 8 of 8
control to the calling method.
sbyte It represents an 8-bit signed integer whose value ranges from -128 to 127.
sealed A sealed class cannot be inherited.
short It represents a 16-bit signed integer whose value ranges from -32,768 to 32,767.
sizeof The sizeof keyword returns how many bytes an object requires to be stored.
stackalloc Allocates a block of memory on the stack.
static
Use the static modifier to declare a static member, which belongs to the type itself rather than
to a specific object.
string The string type represents a string of Unicode characters.
struct
A struct type is a value type that can contain constructors, constants, fields, methods,
properties, indexers, operators, events, and nested types.
switch
The switch statement is a control statement that handles multiple selections by passing
control to one of the case statements within its body.
this
The this keyword refers to the current instance of the class. Static member functions do not
have a this pointer.
throw
The throw statement is used to signal the occurrence of an anomalous situation (exception)
during the program execution.
true In C#, the true keyword can be used as an overloaded operator or as a literal.
try
The try-catch statement consists of a try block followed by one or more catchclauses, which
specify handlers for different exceptions.
typeof The typeof operator is used to obtain the System.Type object for a type.
uint
The uint keyword denotes an integral type that stores values according to the size and range
shown in the following table.
ulong
The ulong keyword denotes an integral type that stores values according to the size and
range shown in the following table.
unchecked
The unchecked keyword is used to control the overflow-checking context for integral-
type arithmetic operations and conversions.
unsafe
The unsafe keyword denotes an unsafe context, which is required for any operation
involving pointers.
ushort
The ushort keyword denotes an integral data type that stores values according to the
size and range shown in the following table.
using The using keyword has two major uses.
virtual
The virtual keyword is used to modify a method or property declaration, in which case
the method or the property is called a virtual member.
volatile
The volatile keyword indicates that a field can be modified in the program by
something such as the operating system, the hardware, or a concurrently executing
thread.
void
When used as the return type for a method, void specifies that the method does not
return a value.
while
The while statement executes a statement or a block of statements until a specified
expression evaluates to false.

More Related Content

What's hot

[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
yasir_cesc
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
K Durga Prasad
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
Raghuveer Guthikonda
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic java
jalinder123
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
Suchit Patel
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
Abed Bukhari
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
Jaya Kumari
 
Declaration of variables
Declaration of variablesDeclaration of variables
Declaration of variables
Maria Stella Solon
 
Control structures in C++ Programming Language
Control structures in C++ Programming LanguageControl structures in C++ Programming Language
Control structures in C++ Programming Language
Ahmad Idrees
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
DITEC - Programming with Java
DITEC - Programming with JavaDITEC - Programming with Java
DITEC - Programming with Java
Rasan Samarasinghe
 
Perl slid
Perl slidPerl slid
Perl slid
pacatarpit
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
Raghu nath
 
javasebeyondbasics
javasebeyondbasicsjavasebeyondbasics
javasebeyondbasics
webuploader
 
Jdk1.5 Features
Jdk1.5 FeaturesJdk1.5 Features
Jdk1.5 Features
india_mani
 
Opps concept
Opps conceptOpps concept
Opps concept
divyalakshmi77
 
Spf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsSpf Chapter5 Conditional Logics
Spf Chapter5 Conditional Logics
Hock Leng PUAH
 
Spf Chapter4 Variables
Spf Chapter4 VariablesSpf Chapter4 Variables
Spf Chapter4 Variables
Hock Leng PUAH
 
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraLambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Jaliya Udagedara
 

What's hot (19)

[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic java
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
Declaration of variables
Declaration of variablesDeclaration of variables
Declaration of variables
 
Control structures in C++ Programming Language
Control structures in C++ Programming LanguageControl structures in C++ Programming Language
Control structures in C++ Programming Language
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
DITEC - Programming with Java
DITEC - Programming with JavaDITEC - Programming with Java
DITEC - Programming with Java
 
Perl slid
Perl slidPerl slid
Perl slid
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
 
javasebeyondbasics
javasebeyondbasicsjavasebeyondbasics
javasebeyondbasics
 
Jdk1.5 Features
Jdk1.5 FeaturesJdk1.5 Features
Jdk1.5 Features
 
Opps concept
Opps conceptOpps concept
Opps concept
 
Spf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsSpf Chapter5 Conditional Logics
Spf Chapter5 Conditional Logics
 
Spf Chapter4 Variables
Spf Chapter4 VariablesSpf Chapter4 Variables
Spf Chapter4 Variables
 
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraLambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
 

Viewers also liked

C# language basics (Visual studio)
C# language basics (Visual studio)C# language basics (Visual studio)
C# language basics (Visual studio)
rnkhan
 
Finnemore ch08 200-299
Finnemore ch08 200-299Finnemore ch08 200-299
Finnemore ch08 200-299
rnkhan
 
Finnemore ch07 182-199
Finnemore ch07 182-199Finnemore ch07 182-199
Finnemore ch07 182-199
rnkhan
 
Finnemore ch06 134-181
Finnemore ch06 134-181Finnemore ch06 134-181
Finnemore ch06 134-181rnkhan
 
Finnemore ch02 004-026
Finnemore ch02 004-026Finnemore ch02 004-026
Finnemore ch02 004-026
rnkhan
 
Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)
Paritosh Kasaudhan
 
[R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com][R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com]
Vijhendra Ramdatt
 
strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )
Ahmad Haydar
 
Engineering surveying, 5...ition w. schofield
Engineering surveying, 5...ition   w. schofieldEngineering surveying, 5...ition   w. schofield
Engineering surveying, 5...ition w. schofield
rnkhan
 
Chap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutionsChap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutions
rnkhan
 
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Pawnpac
 

Viewers also liked (11)

C# language basics (Visual studio)
C# language basics (Visual studio)C# language basics (Visual studio)
C# language basics (Visual studio)
 
Finnemore ch08 200-299
Finnemore ch08 200-299Finnemore ch08 200-299
Finnemore ch08 200-299
 
Finnemore ch07 182-199
Finnemore ch07 182-199Finnemore ch07 182-199
Finnemore ch07 182-199
 
Finnemore ch06 134-181
Finnemore ch06 134-181Finnemore ch06 134-181
Finnemore ch06 134-181
 
Finnemore ch02 004-026
Finnemore ch02 004-026Finnemore ch02 004-026
Finnemore ch02 004-026
 
Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)
 
[R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com][R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com]
 
strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )
 
Engineering surveying, 5...ition w. schofield
Engineering surveying, 5...ition   w. schofieldEngineering surveying, 5...ition   w. schofield
Engineering surveying, 5...ition w. schofield
 
Chap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutionsChap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutions
 
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
 

Similar to C# language basics (Visual Studio)

C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
sachindane
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in java
Shashwat Shriparv
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
Md. Mahedee Hasan
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
Praveen Gorantla
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
Niket Chandrawanshi
 
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1
Techglyphs
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
DevaKumari Vijay
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
RajkumarHarishchandr1
 
1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf
Javier Crisostomo
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
PriyadarshiniS28
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
Fernando Torres
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE
jatin batra
 
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
GANESHBABUVelu
 
c# at f#
c# at f#c# at f#
c# at f#
Harry Balois
 
C# AND F#
C# AND F#C# AND F#
C# AND F#
Harry Balois
 
Data types and operators in vb
Data types and operators  in vbData types and operators  in vb
Data types and operators in vb
alldesign
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
Ali Imran
 
Intake 37 2
Intake 37 2Intake 37 2
Intake 37 2
Mahmoud Ouf
 
Looping statements
Looping statementsLooping statements
Looping statements
Jaya Kumari
 
Introduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh SinghIntroduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh Singh
singhadarsh
 

Similar to C# language basics (Visual Studio) (20)

C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in java
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE
 
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
 
c# at f#
c# at f#c# at f#
c# at f#
 
C# AND F#
C# AND F#C# AND F#
C# AND F#
 
Data types and operators in vb
Data types and operators  in vbData types and operators  in vb
Data types and operators in vb
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
 
Intake 37 2
Intake 37 2Intake 37 2
Intake 37 2
 
Looping statements
Looping statementsLooping statements
Looping statements
 
Introduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh SinghIntroduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh Singh
 

Recently uploaded

DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 

Recently uploaded (20)

DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 

C# language basics (Visual Studio)

  • 1. Page 1 of 8  The first line of the program using System; the using keyword is used to include the System namespace in the program. A program generally has multiple using statements.  The next line has the namespace declaration. A namespace is a collection of classes. The “Hello World” Application namespace contains the class Hello World.  The next line has a class declaration, the class Hello World contains the data and method definitions that your program uses. Classes generally would contain more than one method. Methods define the behavior of the class. However, the Hello World class has only one method Main.  The next line defines the Main method, which is the entry point for all C# programs. The Main method states what the class will do when executed  The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program.  The Main method specifies its behavior with the statement Console.WriteLine("Hello World"); WriteLine is a method of the Console class defined in the System namespace. This statement causes the message "Hello, World!" to be displayed on the screen.  The last line Console.ReadKey(); is for the VS.NET Users. This makes the program wait for a key press and it prevents the screen from running and closing quickly when the program is launched from Visual Studio .NET. Its worth to naote the following points:  C# is case sensitive.  All statements and expression must end with a semicolon (;).  The program execution starts at the main method.  Unlike Java, file name could be different from the class name. C# Type Conversion Methods: C# provides the following built-in type conversion methods:
  • 2. Page 2 of 8 S.N Methods & Description 1 ToBoolean Converts a type to a Boolean value, where possible. 2 ToByte Converts a type to a byte. 3 ToChar Converts a type to a single Unicode character, where possible. 4 ToDateTime Converts a type (integer or string type) to date-time structures. 5 ToDecimal Converts a floating point or integer type to a decimal type. 6 ToDouble Converts a type to a double type. 7 ToInt16 Converts a type to a 16-bit integer. 8 ToInt32 Converts a type to a 32-bit integer. 9 ToInt64 Converts a type to a 64-bit integer. 10 ToSbyte Converts a type to a signed byte type. 11 ToSingle Converts a type to a small floating point number. 12 ToString Converts a type to a string. 13 ToType Converts a type to a specified type. 14 ToUInt16 Converts a type to an unsigned int type. 15 ToUInt32 Converts a type to an unsigned long type. 16 ToUInt64 Converts a type to an unsigned big integer.
  • 3. Page 3 of 8 Accepting Values from User: The Console class in the System namespace provides a function ReadLine() for accepting input from the user and store it into a variable. Arithmetic Operators: Operator Description Example + Adds two operands A + B will give 30 - Subtracts second operand from the first A - B will give -10 * Multiplies both operands A * B will give 200 / Divides numerator by de-numerator B / A will give 2 % Modulus Operator and remainder of after an integer division B % A will give 0 ++ Increment operator increases integer value by one A++ will give 11 -- Decrement operator decreases integer value by one A-- will give 9 Relational Operators: Operator Description Example == Checks if the values of two operands are equal or not, if yes then condition becomes true. (A == B) is not true. != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (A != B) is true. > Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is not true. < Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (A < B) is true. >= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (A >= B) is not true. <= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (A <= B) is true. Logical Operators:
  • 4. Page 4 of 8 Operator Description Example && Called Logical AND operator. If both the operands are non zero then condition becomes true. (A && B) is false. || Called Logical OR Operator. If any of the two operands is non zero then condition becomes true. (A || B) is true. ! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. !(A && B) is true. Conditions: Statement Description if statement An if statement consists of a boolean expression followed by one or more statements. if...else statement An if statement can be followed by an optional else statement, which executes when the boolean expression is false. nested if statements You can use one if or else if statement inside another if or else if statement(s). switch statement A switch statement allows a variable to be tested for equality against a list of values. nested switch statements You can use one switch statement inside another switchstatement(s). C# - Loops: A loop statement allows us to execute a statement or group of statements multiple times . Loop Type Description while loop Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. for loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. do...while loop Like a while statement, except that it tests the condition at the end of the loop body nested loops You can use one or more loop inside any another while, for or do..while loop. Loop Control Statements:
  • 5. Page 5 of 8 Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Control Statement Description break statement Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch. continue statement Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating. C# - Arrays: An array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is accessed by an index. Declaring Arrays: To declare an array in C#, you can use the following syntax: datatype[] arrayName; where,  datatype is used to specify the type of elements to be stored in the array.  [ ] specifies the rank of the array. The rank specifies the size of the array.  arrayName specifies the name of the array. For example, double[] balance; Initializing an Array Array is a reference type, so you need to use the new keyword to create an instance of the array. For example, double[] balance = new double[10];
  • 6. Page 6 of 8 Code Description abstract The abstract modifier can be used with classes, methods, properties, indexers, and events. as The as operator is used to perform conversions between compatible types. base The base keyword is used to access members of the base class from within a derived class bool The bool keyword is an alias of System.Boolean. It is used to declare variables to store the Boolean values, true and false. break The keyword break is used to exit out of a loop or switch block. byte It represents an 8-bit unsigned integer whose value ranges from 0 to 255. case case is often used in a switch statement. catch The keyword catch is used to identify a statement or statement block for execution char It represents a Unicode character whose from 0 to 65,535. checked The checked keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions. class The class keyword is used to declare a class. const The const keyword is used in field and local variable declarations to make the variable constant continue Its affect is to end the current loop and proceed to the next one. decimal The decimal keyword denotes a 128-bit data type. default The default keyword can be used in the switch statement delegate The delegate keyword is used to declare a delegate. A delegate is a programming construct that is used to obtain a callable reference to a method of a class. do The do statement executes a statement or a block of statements repeatedly until a specified expression evaluates to false. double The double keyword denotes a simple type that stores 64-bit floating-point values. else An else clause immediately follows an if-body. It provides code to execute when the condition is false. enum The enum keyword is used to declare an enumeration, a distinct type consisting of a set of named constants called the enumerator list. event It is used to declare an event. explicit The explicit keyword is used to declare an explicit user-defined type conversion operator extern Use the extern modifier in a method declaration to indicate that the method is implemented externally. false The false keyword is a boolean constant value finally The finally block is useful for cleaning up any resources allocated in the try block. fixed Prevents relocation of a variable by the garbage collector. float The float keyword denotes a simple type that stores 32-bit floating-point values. for The for loop executes a statement or a block of statements repeatedly until a specified expression evaluates to false. foreach The foreach statement repeats a group of embedded statements for each element in an array or an object collection.
  • 7. Page 7 of 8 goto The goto statement transfers the program control directly to a labeled statement. if The if statement selects a statement for execution based on the value of a Boolean expression. implicit The implicit keyword is used to declare an implicit user-defined type conversion operator. in The in keyword identifies the collection to enumerate in a foreach loop. int The int keyword denotes an integral type that stores values according to the size and range interface The interface keyword is used to declare an interface. Interfaces provide a construct for a programmer to create types that can have methods, properties, delegates, events, and indexers declared, but not implemented. internal The internal keyword is an access modifier for types and type members. That is, it is only visible within the assembly that implements it. is The is operator is used to check whether the run-time type of an object is compatible with a given type. Using is on a null variable always returns false. lock The lock keyword marks a statement block as a critical section by obtaining the mutual- exclusion lock for a given object, executing a statement, and then releasing the lock. long The long keyword denotes an integral type that stores values according to the size and range.That is, it represents a 64-bit signed integer whose value ranges from - 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. namespace The namespace keyword is used to supply a namespace for class, structure, and type declarations. new In C#, the new keyword can be used as an operator or as a modifier. null The null keyword is a literal that represents a null reference, one that does not refer to any object. object It represents the base class from which all other reference types derive. operator The operator keyword is used to declare an operator in a class or struct declaration. out The out method parameter keyword on a method parameter causes a method to refer to the same variable that was passed into the method override Use the override modifier to modify a method, a property, an indexer, or an event. params The keyword params is used to describe when a grouping of parameters are passed to a method, but the number of parameters are not important, as they may vary. private To make the field, method, or property private to its enclosing class. That is, it is not visible outside of its class. protected To make the field, method, or property protected to its enclosing class. That is, it is not visible outside of its class. public To make the field, method, or property public to its enclosing class. That is, it is visible from any class. readonly The readonly keyword is a modifier that you can use on fields. ref The ref keyword explicitely specifies that a variable should be passed by reference rather than by value. return The return statement terminates execution of the method in which it appears and returns
  • 8. Page 8 of 8 control to the calling method. sbyte It represents an 8-bit signed integer whose value ranges from -128 to 127. sealed A sealed class cannot be inherited. short It represents a 16-bit signed integer whose value ranges from -32,768 to 32,767. sizeof The sizeof keyword returns how many bytes an object requires to be stored. stackalloc Allocates a block of memory on the stack. static Use the static modifier to declare a static member, which belongs to the type itself rather than to a specific object. string The string type represents a string of Unicode characters. struct A struct type is a value type that can contain constructors, constants, fields, methods, properties, indexers, operators, events, and nested types. switch The switch statement is a control statement that handles multiple selections by passing control to one of the case statements within its body. this The this keyword refers to the current instance of the class. Static member functions do not have a this pointer. throw The throw statement is used to signal the occurrence of an anomalous situation (exception) during the program execution. true In C#, the true keyword can be used as an overloaded operator or as a literal. try The try-catch statement consists of a try block followed by one or more catchclauses, which specify handlers for different exceptions. typeof The typeof operator is used to obtain the System.Type object for a type. uint The uint keyword denotes an integral type that stores values according to the size and range shown in the following table. ulong The ulong keyword denotes an integral type that stores values according to the size and range shown in the following table. unchecked The unchecked keyword is used to control the overflow-checking context for integral- type arithmetic operations and conversions. unsafe The unsafe keyword denotes an unsafe context, which is required for any operation involving pointers. ushort The ushort keyword denotes an integral data type that stores values according to the size and range shown in the following table. using The using keyword has two major uses. virtual The virtual keyword is used to modify a method or property declaration, in which case the method or the property is called a virtual member. volatile The volatile keyword indicates that a field can be modified in the program by something such as the operating system, the hardware, or a concurrently executing thread. void When used as the return type for a method, void specifies that the method does not return a value. while The while statement executes a statement or a block of statements until a specified expression evaluates to false.