Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 34

.

NET FUNDAMENTALS
Agenda

● Introduction to .NET and Visual Studio


● C# Fundamentals
● Control Flow Statements

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
Introduction to .NET and Visual Studio
Introduction to .NET and Visual Studio

Evolution and Overview of .NET

● .NET is a framework used to develop various software applications


● This product was designed and developed by Microsoft around 1990’s
● The class libraries present in this framework is known as FCL - Framework Class Library
● Execution takes place in environment called CLR - Common Language Runtime
● Latest version released in 2019 - .NET Framework 4.8
● .NET Framework supports 60+ Programming languages

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
Introduction to .NET and Visual Studio

Overview of Visual Studio


● Visual Studio is an Integrated Development Environment (IDE) used to develop application, games and others
● It is product of Microsoft developed in the year 2000
● It has capability to support 36 + programing languages
● Latest stable release is Visual Studio 2019 (Dev 16)
● Preview version is Visual Studio 2022 ( Dev 17)

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
Introduction to .NET and Visual Studio

Features of Visual Studio

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
Introduction to .NET and Visual Studio

From where to download Visual Studio 2019 ?


visit : https://visualstudio.microsoft.com/vs/ > Click on Download Visual Studio > Select Community 2019 > Install the .exe file

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals
C# Fundamentals

Basic Program Structure


using System; // To fetch system library
namespace identifier_name // used to organize classes
{
class class_name // declaration of class
{
static void Main( ) // Main Method
{
Console.WriteLine(" Code ");
}
DO NOT WRITE ANYTHING
} HERE. LEAVE THIS SPACE FOR
WEBCAM
}
C# Fundamentals

Identifiers
A name for a class, variable, function, method or any other user-defined entity is called an identifier.

Example:

public class CAR // CAR - Class Name


{
static public void Main( ) // Main method name
{
int a; // a - Variable name
}
}

NOTE: Make sure identifier’s name doesn't match C# keyword


DO NOT WRITE ANYTHING
HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals

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.

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals
Types of Keywords Keywords
Modifier Keywords abstract, async, const, event, extern, new, override,
partial, readonly, sealed, static, unsafe, virtual, volatile
Access Modifier Keywords public, private, protected, internal
Statement Keywords if, else, switch, case, do, for, foreach, in, while, break,
continue, default, goto, return, yield, throw, try, catch,
finally, checked, unchecked, fixed, lock

Method Parameter params, ref, out


Keyword
Access Keywords base, this
Namespace Keywords using, . operator, :: operator, extern alias

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals
Literal Keywords null, false, true, value, void
Operator Keywords as, await, is, new, sizeof, typeof, stackalloc, checked,
unchecked

Contextual Keywords add, var, dynamic, global, set, value


Type Keywords bool, byte, char, class, decimal, double, enum, float, int,
long, sbyte, short, string, struct, uint, ulong, ushort

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.

Syntax: <datatype> < variable_name>;


Example: int a;

Data Types Examples

Integer Data Type int, long, char, short

Floating Point Data Type Float and Double data types

Decimal Data Type Decimal data types

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

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals

Constants
The constants are fixed values that the programme cannot change while it is running. Literals are another name for
these fixed values

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals

Type Conversions
The method used to convert from one datatype to another is known as Type Conversion/ Type Casting.

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals

Boxing and Unboxing


● Boxing and Unboxing provide a unified view of the type system, allowing any type value to be handled as
an object.
● Boxing is a implicit process that converts value type to reference/object type
● Unboxing is a explicit process that converts reference/object type to value type

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
C# Fundamentals

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)
}

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
Control Flow Statements

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

● Introduction to .NET Framework and Visual Studio overview is known.


● Code Editor, Debugger, Designer, Extensibility are the different features of Visual Basics
● Fundamental concepts of C# like Basic program structure, Variables , Constants , Boxing and
Unboxing
● Control flow statements different types of decision making and looping statements was discussed
with relevant coding examples

DO NOT WRITE ANYTHING


HERE. LEAVE THIS SPACE FOR
WEBCAM
Thank You

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited

You might also like