标签:ast nbsp ica gic method convert str short cas
Class
Namespace
Assembly (DLL or EXE)
Application
Primitive Types (C# type)
Something tricky about real numbers
float number = 1.2;
decimal number = 1.2;
float number = 1.2f;
decimal number = 1.2m;
Non-Primitive Types
Overflowing
byte number = 255;
number = number + 1; //0
Scope
Type Conversion
byte a = 1;
int b = a;
int c = 1;
byte d = (byte)c;
string e = "100";
int f = int.Parse(e)
var a = "1234";
int b = Convert.ToInt32(a);
C# Operators
var a = 10;
var b = 3;
Console.WriteLine(a+b); // 3
Console.WriteLine((float)a / (float)b); // 3.333333
int a = 1;
int b = a++; //b = 1, a = 2;
int a = 1;
int b = ++a; //b = 2, a = 2;
Comments
// Here is a single-line comment
/*
Here is a multi-line
comment
*/
Primitive Types and Expressions
标签:ast nbsp ica gic method convert str short cas
原文地址:http://www.cnblogs.com/jarodli/p/8016168.html