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

PPTX
Java Programming
PPTX
Vb script final pari
DOCX
PPTX
Variable and constants in Vb.NET
PPTX
Generic Programming in java
PPTX
Operators in java
PDF
PPT
M C6java3
Java Programming
Vb script final pari
Variable and constants in Vb.NET
Generic Programming in java
Operators in java
M C6java3

What's hot (19)

PDF
[C++][a] tutorial 2
PPT
Getting started with c++
PPTX
Operators & Casts
PPSX
Dr. Rajeshree Khande : Programming concept of basic java
PPTX
Cpu-fundamental of C
PPT
Csharp4 basics
PPTX
Operators used in vb.net
PPT
Control structures in C++ Programming Language
PPT
Declaration of variables
PPSX
Esoft Metro Campus - Certificate in c / c++ programming
PPSX
DITEC - Programming with Java
PPTX
Perl slid
PPTX
2.overview of c#
ODP
javasebeyondbasics
PPT
Jdk1.5 Features
PDF
Opps concept
PPTX
Spf Chapter5 Conditional Logics
PPTX
Spf Chapter4 Variables
PPTX
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
[C++][a] tutorial 2
Getting started with c++
Operators & Casts
Dr. Rajeshree Khande : Programming concept of basic java
Cpu-fundamental of C
Csharp4 basics
Operators used in vb.net
Control structures in C++ Programming Language
Declaration of variables
Esoft Metro Campus - Certificate in c / c++ programming
DITEC - Programming with Java
Perl slid
2.overview of c#
javasebeyondbasics
Jdk1.5 Features
Opps concept
Spf Chapter5 Conditional Logics
Spf Chapter4 Variables
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Ad

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

PPTX
Chapter3: fundamental programming
PPSX
C# - Part 1
PPSX
DISE - Windows Based Application Development in C#
PPT
Introduction to c#
PPSX
DITEC - Programming with C#.NET
PPTX
Week 1: Getting Your Hands Dirty - Part 1
PPTX
C# 101: Intro to Programming with C#
PDF
Introduction to c first week slides
PPT
For Beginners - C#
PPTX
Operators loops conditional and statements
PPTX
How To Code in C#
PPTX
C# basics
PPTX
PPT
Presentatiooooooooooon00000000000001.ppt
PPTX
Chapter i c#(console application and programming)
PPTX
C Sharp Course 101.5
PDF
CSharpCheatSheetV1.pdf
PPTX
C sharp part 001
PDF
The C Player s Guide 3rd Edition Rb Whitaker
PDF
The C Player s Guide 3rd Edition Rb Whitaker
Chapter3: fundamental programming
C# - Part 1
DISE - Windows Based Application Development in C#
Introduction to c#
DITEC - Programming with C#.NET
Week 1: Getting Your Hands Dirty - Part 1
C# 101: Intro to Programming with C#
Introduction to c first week slides
For Beginners - C#
Operators loops conditional and statements
How To Code in C#
C# basics
Presentatiooooooooooon00000000000001.ppt
Chapter i c#(console application and programming)
C Sharp Course 101.5
CSharpCheatSheetV1.pdf
C sharp part 001
The C Player s Guide 3rd Edition Rb Whitaker
The C Player s Guide 3rd Edition Rb Whitaker
Ad

More from rnkhan (8)

PDF
Finnemore ch08 200-299
 
PDF
Finnemore ch06 134-181
 
PDF
Finnemore ch07 182-199
 
PDF
Finnemore ch02 004-026
 
DOCX
C# language basics (Visual Studio)
 
PPTX
Chap#6 Beam Deflections solutions
 
PPTX
Chap#5 Stresses in Beams solutions
 
PDF
Engineering surveying, 5...ition w. schofield
 
Finnemore ch08 200-299
 
Finnemore ch06 134-181
 
Finnemore ch07 182-199
 
Finnemore ch02 004-026
 
C# language basics (Visual Studio)
 
Chap#6 Beam Deflections solutions
 
Chap#5 Stresses in Beams solutions
 
Engineering surveying, 5...ition w. schofield
 

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Digital Strategies for Manufacturing Companies
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Cost to Outsource Software Development in 2025
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
System and Network Administraation Chapter 3
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
L1 - Introduction to python Backend.pptx
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
top salesforce developer skills in 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Digital Strategies for Manufacturing Companies
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Understanding Forklifts - TECH EHS Solution
Operating system designcfffgfgggggggvggggggggg
Cost to Outsource Software Development in 2025
Wondershare Filmora 15 Crack With Activation Key [2025
Why Generative AI is the Future of Content, Code & Creativity?
System and Network Administraation Chapter 3
Upgrade and Innovation Strategies for SAP ERP Customers
wealthsignaloriginal-com-DS-text-... (1).pdf
Computer Software and OS of computer science of grade 11.pptx
L1 - Introduction to python Backend.pptx
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Odoo POS Development Services by CandidRoot Solutions

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.