Chapter 2 Quick Reference


Chapter 2 Quick Reference

To

Do this

Declare a variable

Write the name of the data type, followed by the name of the variable, followed by a semicolon. For example:

int outcome;

Change the value of a variable

Write the name of the variable on the left, followed by the assignment operator, followed by the expression calculating the new value, followed by a semicolon. For example:

outcome = 42;

Convert a string to an int

Call the System.Int32.Parse method. For example:

System.Int32.Parse("42");

Override precedence

Use parentheses in the expression to force operands to bind to specific operators. For example:

(3 + 4) * 5

Increment or decrement a variable

Use the ++ or <;$MI><;$MI> operator. For example:

count++;




Microsoft Visual C# 2005 Step by Step
Microsoft® Visual C#® 2005 Step by Step (Step By Step (Microsoft))
ISBN: B002CKYPPM
EAN: N/A
Year: 2005
Pages: 183
Authors: John Sharp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net