0% found this document useful (0 votes)
17 views4 pages

Class 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views4 pages

Class 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

C#

======

IDE = Visual Studio - 2022


Framework

Project(Namespace) - Myproject

Collection of classes

Location - save the path

Solution -
collection of projects

Class
collection of methods and members

C#
====

. every statement end with semicolon;


. it is a case sensitive language
. do not use reserved keywords

output statements
=======================
Console.Write()
Console.WriteLine()

input statements
==========================
Console.Read()
Console.ReadLine()

hold the output screen until press any key


=====================

Console.Readkey()

DataTypes

int a=10;
a -> integer variable
10 -> integer value

Value Type
int,float,decimal....etc

value types always contain range and specific memory


Reference Type
class,string,object,....etc
Operators
======================

Arithmetic operators - + - / % *
Assignment operators - = ?=
Comparison operators - > < >= <=
Equality operators - = ==
Boolean logical operators - true / false
Betwise and shift operators - && ||
Member access operators
Type-cast operators
Pointer related operators

Conditional statements
=======================

if
if else
else if
nested if

switch

condition for true or false statements

syntax
==========

if(condition) - true
{

}
else
{

Debug
===========

F9 - break point
F11 - step into
F10 - step out

using System;

namespace MyfirstConsole
{
internal class Program
{
static void Main()
{

byte age = 0;
Console.WriteLine("please enter your age");

age = byte.Parse(Console.ReadLine());

if (age > 18)


{
Console.WriteLine("You r eligible for vote");
}

Console.ReadKey();

}
}

=================

using System;

namespace MyfirstConsole
{
internal class Program
{
static void Main()
{

byte age = 0;

Console.WriteLine("please enter your age");

age = byte.Parse(Console.ReadLine());

if (age > 18)


{
Console.WriteLine("You r eligible for vote");
}
else
{
Console.WriteLine("You r not eligible for vote");
}

Console.ReadKey();

}
}

=============================

using System;

namespace MyfirstConsole
{
internal class Program
{
static void Main()
{

int atm = 0;

Console.WriteLine("please enter your atm pin");

atm = int.Parse(Console.ReadLine());

if (atm == 5674)
{
Console.WriteLine("Welcome to Axis Bank");
}
else
{
Console.WriteLine("Please enter correct pin!");
}

Console.ReadKey();

}
}

==============================

You might also like