Part 5 - C# Tutorial - Common Operators in c#.avi

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

All C# Text Articles

All C# Slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

In this video, we will discuss the common operators that are available in c# programming language.

Assignment Operator =
Arithmetic Operators like +,-,*,/,%
Conditional Operators like &&, ||
Ternary Operator ?:
Null Coalescing Operator ??

Program without ternary Operator
using System;
class Program
{
static void Main()
{
int Number = 10;

bool IsNumber10;

if (Number == 10)
{
IsNumber10 = true;
}
else
{
IsNumber10 = false;
}

Console.WriteLine("i == 10 is {0}", IsNumber10);
}
}

Same program with ternary Operator
using System;
class Program
{
static void Main()
{
int Number = 10;

bool IsNumber10 = Number == 10 ? true : false;

Console.WriteLine("i == 10 is {0}", IsNumber10);
}
}
Рекомендации по теме
Комментарии
Автор

Hi Venkat,

I keep a high regard towards you for this and all the other series which you have provided with hard work and pure knowledge but without letting any type of gain come between.

A true teacher of knowledge.

Many Thanks & Regards

next-steps
Автор

The conditional-OR operator (||) performs a logical-OR of its bool operands. If the first operand evaluates to true, the second operand isn't evaluated.

The conditional-AND operator (&&) performs a logical-AND of its bool operands, but only evaluates its second operand if necessary. if firts operand is false, second operator is not evaluated, because the result of the AND operation is false no matter what the value of second operator.

Binary | operators are predefined for the integral types and bool. For integral types, | computes the bitwise OR of its operands. For bool operands, | computes the logical OR of its operands; that is, the result is false if and only if both its operands are false.

Binary & operators are predefined for the integral types and bool. For integral types, & computes the logical bitwise AND of its operands. For bool operands, & computes the logical AND of its operands; that is, the result is true if and only if both its operands are true.

Operators || and && is a known as "short-circuit" evaluations.

vladapetkovic
Автор

using System;
//Part 05 - Commone Operators in C Sharp
// Assignment Operator =
// Arithmetic Operatiors +. -, *, /, %
// Comparison Operator ==, !=, >, >=, <=
// Conditional Operator &&, ||
// Ternary Operator ?:
// Null Coalescing Operator ??
class Program
{
static void Main()
{
//int Numerator = 10;
//int Denominator = 2;

//int Result = Numerator / Denominator; // Division Operator
//int Result = Numerator % Denominator; // Modulus Operator

//Console.WriteLine("Result = {0}", Result);

//int Number = 10;
//int AnotherNumber = 21;

//Exclusive AND
//if (Number == 10 && AnotherNumber == 20)
//{
// Console.WriteLine("Hello");
//}

//Exclusiove OR
//if (Number == 10 || AnotherNumber == 20)
//{
// Console.WriteLine("Hello");
//}

//Ternary Operator

int Number = 10;

//bool isNumber10;

//if (Number == 10)
//{
// isNumber10 = true;
//}
//else
//{
// isNumber10 = false;
//}

bool isNumber10 = Number == 10 ? true : false;

Console.WriteLine("Number == 10 is {0}", isNumber10);
}
}

KimaniWaNdirangu
Автор

BEST CHANNEL FOR LEARN C#
I'M IN CLASS X BUT I easily UNDERSTOOD... TOPICS.

developerakhter______
Автор

Hi,
Are these video's enough to learn the basics of C# with a non programmers background?

ersanydz
Автор

Your videos are very help full.. Can i get those slides you are using ?

akhilreddy
Автор

Those Ternary operators man... ive wasted so many years writing If Else statements

Moosenthusiast
Автор

Hi Venkat,
Thank you for the video and please keep up the good work, but i think you have missed out two of the variants of 'OR' and 'AND' operators which are represented by " | " --> OR and " & " -->And . Using these operators enables developer to check other conditions too in the IF statement even if the first condition fails unlike "&&" and "||". If you can add these too as well in your video it will be great for new learners.

SalmanKhan-tljz
Автор

Sir please explain scope resolution operator in c#

nitishawasthi
Автор

We can use: bool IsNumber10 = (Number==10);

mateuszkorolow
Автор

bool IsNumber10 = Number==10; // that's enough

ApuTube
Автор

im watching this video on 28th april, 203

UniqueCreatorSuraj
Автор

I really love this series but it would be nice if you could update it.

gordonmctague
Автор

That is easily the best explanation of the ternary operator.

mattr
Автор

Jo topic mujhe phele se doubt ms hain jinka knowledge kum hain use eng me samjana tough h mere liy

kirtisahu
Автор

you can also do just
bool IsNumber10 = Number == 10;


Because "Number == 10" returns a boolean.

modgenesis
Автор

Is it possible to execute multiple expressions based true or false in ternary operator just like javascript?If yes, please help me to get to it...Thanks in advance...

chiraglangaliya
Автор

Thank you so much Venkat, it's my go-to point when ever I try to refresh my basics

Nicetrycutiepie
Автор

Fourth operators are logical one's!!conditional(?:) and ternary both r same....

sairam
Автор

I had a pretty good handle on the operators except for the Ternary operator. That is going to CHANGE MY LIFE! Thank you Venkat! Love the video tutorials!

stevenlawson