c# operator

+ 	Addition	Computes the sum of left and right operands.	int x = 5 + 5;

-	Subtraction	Subtract the right operand from the left operand	int x = 5 - 1;

*	Multiplication	Multiply left and right operand	int x = 5 * 1;

/	Division	Divides the left operand by the right operand	int x = 10 / 2;

&&	Computes the logical AND of its bool operands. Returns true both operands are true, otherwise returns false.	x && y;

||	Computes the logical OR of its bool operands. Returns true when any one operand is true.	x || y;

!	Reverses the bool result of bool expression. Returns false if result is true and returns true if result is false.	!false

%	Reminder	Computes the remainder after dividing its left operand by its right operand	int x = 5 % 2;

++	Unary increment	Unary increment ++ operator increases its operand by 1	x++
  
--	Unary decrement	Unary decrement -- operator decreases its operand by 1	x--
  
+	Unary plus	Returns the value of operand	+5
  
-	Unary minus	Computes the numeric negation of its operand.	-5

  =	Assignment	Assigns its right had value to its left-hand variable, property or indexer.	x = 10;

x op= y	Compound assignment	Short form of x =x op y where op = any arithmetic, Boolean logical, and bitwise operator.	x += 5;

??=	Null-coalescing assignment	C# 8 onwards, ??= assigns value of the right operand only if the left operand is null	x ??= 5;


Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source