Professional Documents
Culture Documents
EContent 11 2022 04 15 10 25 44 Unit 1pptx 2022 03 07 13 47 27
EContent 11 2022 04 15 10 25 44 Unit 1pptx 2022 03 07 13 47 27
BASICS OF C#
ITRODUCTION
• C# (C-Sharp) is a programming language
developed by Microsoft that runs on the .NET
Framework.
• C# is used to develop web apps, desktop apps,
mobile apps, games and much more.
.NET Framework
• Simple
• Modern programming language
• Object oriented
• Type safe
• Interoperability
• Scalable and Updateable
• Component oriented
• Structured programming language
• Rich Library
• Fast speed
C# PROGRAM STRUCTURE
• Library invoked by the keyword "using".
• Declaring namespace using the "namespace"
keyword.
• Declaring a class using the keyword "class".
• Class members and attributes.
• The Main() method.
• Other statements and expressions.
• Writing comments for user understanding and non-
executable statements.
using System;
namespace printHelloCsharp
{
class HelloCsharp
{
static void Main(string[] args)
{
Console.WriteLine("Hello C#."); Console.ReadKey();
}}}
C# Variable
• Arithmetic Operators
• C# Comparison Operators
• C# Logical Operators
C# If ... Else
Synatx:
if (condition1)
{ // block of code to be executed if condition1 is True
}
else if (condition2)
{ // block of code to be executed if the condition1 is false and condition2
is True
}
else
{ // block of code to be executed if the condition1 is false and condition2
is False
}
• While( condition)
• {
• ------body while loop
• }