This is a C # Basic learning article, the master can skip,
1. Basic type:
Basically the same as c\c++
Decimal decimal is a 128-bit high precision floating-point number.
BOOL Note that the BOOL type has only true and faulse two desirable values, in C #, the bool value cannot be cast to an integer value. For example, it is not possible to convert true to 1 or convert 1, 0 to bool values.
Parse and TryParse conversion strings
Basic numeric types contain parse and TryParse methods that convert numeric string types to the specified number type, such as
int iParse = Int32.Parse("1000");
float fParse = float.Parse("1.2"');
TryParse can provide conditional parsing, which returns a Boolean value to indicate whether the resolution was successful, eliminating the hassle of adding a field to handle the code.
int result;
book ok = Int32.TryParse("100" , out result);
2. Control structure
It's basically the same as c\c++, with a foreach loop, which is equivalent to a PHP foreach, but the collection Class (collections) in. NET can be used in a foreach loop.
3. Preprocessing instructions
Similar to c\c++, the most common uses are conditional compilation, increased diagnostics to report errors and warnings, and defining code domains.
(1) Conditional compilation
#define DEBUG
using System;
public class MyApp
{
public static void Main()
{
#if(DEBUG)
Console.WriteLine("Debug Mode");
#else
Console.WriteLine("Release Mode");
#endif
}
}