Three elements: Convert, operator, flow control statement, ref/out/in three types of parameters

Source: Internet
Author: User

First, the type conversion method commonly used by convert class
Convert.ToInt32 () to Integer (int)
Convert.tochar () converted to character type (char)
Convert.ToString () converted to string type (string)
Convert.todatetime () converted to date (datetime)
Convert.todouble () converted to double-precision floating-point type (double)
Conert.tosingle () converted to single-precision floating point (float)

Second, operator
Arithmetic operator +-*/%
Logical Operators & | ^ ~ && | | !
String Join operator +
Increment and decrement operator + +--
Shift Operators << >>
comparison operator = = = < > <= >=
Assignment operator = + = = *=/=%= |= ^= <<= >>=
Conditional operator (ternary operator)?:
Comparison of infrequently used but important operators:
The IS operator can check whether an object is compatible with a particular type.
The as operator is used to perform an explicit type conversion of a reference type.

Third, the Process Control statements
Control flow
if (bool) {}else{}
if (boll) else if (bool) else{}
Switch ()
{
Case:
Break
Default:
Break
}
Looping statements
for (int i==0;i<int;i++) {}
while (true) {}
Do{}while (True) loop
Traverse only
foreach (Tabelrow tr in datatabel.rows) {}

Four, ref/out/in three kinds of parameter types
In: The procedure does not overwrite the contents of in, but can be read, so you have to have a value before passing in. ----------------------------------Read-only
Out and out: The value passed in is not read by the procedure, but the procedure can be written, so the assignment before passing in is meaningless I do not read. -------------Write only
Ref: The value passed in, the procedure will read, and will be written. Because it reads, you have to have a value before you pass in. -----------------------------Read and Write

Three elements: Convert, operator, flow control statement, ref/out/in three types of parameters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.