Changes

Jump to: navigation, search

C Sharp Operators and Expressions

687 bytes added, 19:11, 14 January 2008
The Basic Assignment Operator
x = y = z = 20;
</pre>
 
== C# Arithmetic Operators ==
 
C# provides a range of operators for the purpose of creating mathematical expressions. These operators primarily fall into the category of ''binary'' operators in that they take to operands. The exception is the ''negative'' operator (-) which serves to indicate that a value is negative rather than positive. This contrasts the the ''subtraction operator'' (-) which takes two operands (i.e one value to be subtracted from another). For example:
 
<pre>
int x = -10; // Unary - operator used to assign -10 to a variable named x
 
x = y - z; // Subtraction operator. Subtracts z from y
</pre>
 
The following table lists the primary C# arithmetic operators:
== Compound Assignment Operators ==

Navigation menu