Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0055 Operators in C#

C# has the following operators. Operator symbol Operator name User- overloadable () Grouping No . Member access No -> Pointer to struct No () Function call No [] Array/index Via indexer ++ Post-increment Yes -- Post-decrement Yes new Create instance No stackalloc Unsafe stack allocation No typeof Get type from identifier No checked Integral overflow check on No unchecked Integral overflow check off No sizeof Get size of struct No + Positive value of Yes - Negative value of Yes ! Not Yes ~ Bitwise complement Yes ++ Pre-increment Yes -- Pre-decrement Yes () Cast No * Value at address No & Address of value No * Multiply Yes / Divide Yes % Remainder Yes + Add Yes - Subtract Yes << Shift left Yes >> Shift right Yes < Less than Yes > Greater than Yes <= Less than or equal to Yes >= Greater than or equal to Yes is Type is or is subclass of No as Type conversion No == Equals Yes != Not equals Yes & And Yes ^ Exclusive Or Yes | Or Yes && Conditional And Via & || Conditional Or Via | ?? Null coalescing No ?: Conditional No = Assign No *= Multiply self by Via * /= Divide self by Via / += Add to self Via + -= Subtract from self Via - <<= Shift self left by Via << >>= Shift self right by Via >> &= And self by Via & ^= Exclusive-Or self by Via ^ |= Or self by Via | => Lambda No