Professional Documents
Culture Documents
NET Fundamentals
NET Fundamentals
NET FUNDAMENTALS
Agenda
Identifiers
A name for a class, variable, function, method or any other user-defined entity is called an identifier.
Example:
Keywords
● Keywords are reserved terms(words) that the C# compiler has predefined.
● The @ character can be used to prefix the keyword. (In case to be used as identifier)
● Contextual keywords are identifiers that have a special meaning in the context of code, such as
get,set,into,from , join etc.
Query Keywords from, where, select, group, into, orderby, join, let, in, on,
equals, by, ascending, descending
NOTE:
#1 There are total 78 + Keywords in C#
#2 There are 30 + Contextual Keywords DO NOT WRITE ANYTHING
HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals
Variables
A variable is nothing more than a name for a storage region that programmes can access.
A set of operations that can be performed on the variable.
Boolean Data Type True or False data types DO NOT WRITE ANYTHING
HERE. LEAVE THIS SPACE FOR
Nullable Data Type Null valued data types WEBCAM
C# Fundamentals
Categories of Variable
Constants
The constants are fixed values that the programme cannot change while it is running. Literals are another name for
these fixed values
Type Conversions
The method used to convert from one datatype to another is known as Type Conversion/ Type Casting.
Expressions
● In C#, an expression is a set of operands (variables, literals, and method calls) that can be
evaluated to a single value.
● There must be at least one operand in an expression, although there may or may not be any
operators.
Operators
● A symbol that instructs the compiler to conduct specified mathematical or logical
operations is known as an operator.
● C# comes with a large number of built-in operators, including the following:
● Arithmetic Operators
● Relational Operators
● Logical Operators DO NOT WRITE ANYTHING
● Bitwise Operators HERE. LEAVE THIS SPACE FOR
● WEBCAM
Assignment Operators
Control Flow Statements
Control Flow Statements
Control Flow Statements
Decision Making
if statement
if (condition)
{
// Code ( True )
}
Control Flow Statements
if - else statement
if (condition)
{
// Code ( True )
}
else
{
// Code ( False)
}
if - else - if statement
if (condition1)
{
// executes if condition 1 is true
}
else if (condition2)
{
// executes if condition 1 is false and condition 2 is true
}
………..
else
{
// executes if all the conditions are false
}
Control Flow Statements
nested if statement
if (condition )
{
if (nested-condition -1)
{
// code
}
else
{
// code
}
}
else
{
if (nested-condition-2)
{
// code
}
else
{
// code
}
}
Control Flow Statements
switch statement
switch(condition)
{
case 1:
// statement 1
break;
case 2:
// statement 2
break;
case n:
// statement n
default:
// default d
break;
}
Control Flow Statements
Ternary Operator
Condition ? Expression1 : Expression2;
Control Flow Statements
while loop
while (condition)
{
// code to be executed
}
Control Flow Statements
do - while loop
do
{
// code to be executed
} while (condition);
Control Flow Statements
for Loop
for (initialization; condition; iteration)
{
// code body
}
Control Flow Statements
foreach loop
foreach (element in iterable-item)
{
// body of foreach loop
True
}
False
Control Flow Statements
nested loop
nested for loop nested while loop
for(variable initialization; testing condition; increment / while(condition)
decrement) {
{ while(condition)
for(variable initialization; testing condition; {
increment / decrement) // Statements
{ }
// Statements
} // Statements
} }
Summary
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited