Part 28 C# Operators 4 Unary And Member Accessing
Unary And Member Accessing
C# provides many operators, which are symbols that specify which operations (math, indexing, function call, etc.) to perform in an expression. You can overload many operators to change their meaning when applied to a user-defined type.
Operations on integral types (such as ==, !=, &, |) are generally allowed on enumeration (enum) types.
The sections below list the C# operators starting with the highest precedence to the lowest. The operators within each section share the same precedence level.
Arithmetic Overflow
The arithmetic operators (+, -, *, /) can produce results that are outside the range of possible values for the numeric type involved. You should refer to the section on a particular operator for details, but in general:
• Integer arithmetic overflow either throws an OverflowException or discards the most significant bits of the result. Integer division by zero always throws a DivideByZeroException.
When integer overflow occurs, what happens depends on the execution context, which can be checked or unchecked. In a checked context, an OverflowException is thrown. In an unchecked context, the most significant bits of the result are discarded and execution continues. Thus, C# gives you the choice of handling or ignoring overflow. By default, arithmetic operations occur in an unchecked context.
In addition to the arithmetic operations, integral-type to integral-type casts can cause overflow (such as when you cast a long to an int), and are subject to checked or unchecked execution. However, bitwise operators and shift operators never cause overflow.
• Floating-point arithmetic overflow or division by zero never throws an exception, because floating-point types are based on IEEE 754 and so have provisions for representing infinity and NaN (Not a Number).
• Decimal arithmetic overflow always throws an OverflowException. Decimal division by zero always throws a DivideByZeroException.
Assignment and Lambda Operators
Conditional Operator
Null-coalescing Operator
#HindiTutorial #DilipSir #askDilipSir #Youtuber #YouTube #you_tuber
#Dilip #sir #india #tech #technology #videos #best #tutorial #how
#know_how #CSharp #Excel #Word #HTML #CSS #ComputerTips_Tricks
#ASP.net #WinFormApp #HowtoFix #VisualStudio #MSPowerPoint
#OutLook #SQL #Hindi #Urdu #SocialTech #Facebook #GamePlays
#gameplay #game_play #playGame #CallofDuty #CsharpinHindi #HTML5
#Advance_Excel
#IA, #RRB, #IBPS, #SSC, #UPPSC, #2nd Grade, #LDC, #POLICE, #COMPUTER, #RAILWAY, #ASSISTANT, #TEACHER