Small Knowledge (ii)
Bitwise operators:
and:& bits are all 1 o'clock, the result is 1, otherwise 0. Binary operations, bitwise comparison.
Or: | Bits are 0 o'clock, the result is 0, otherwise 1. Binary operations, bitwise comparison.
XOR: ^ bits phase, the result is 0, otherwise 1. Binary operations, bitwise comparison.
Inverse: ~ Binary 0 o'clock, the result is 1, otherwise 0. Unary operation, bitwise comparison.
The left displacement:<< is equal to the N power by 2. Binary operations.
The right displacement:>> equals the n power of 2. Binary operations.
Logical operators:
Or: | | When two bool values are false, the result is false, otherwise true. Binary operations.
Logical non-:! False, the result is true. A unary operation.
The logical and:&& two bool values are true when the result is true, otherwise false. Binary operations.
PLACEHOLDER:
Placeholders are often used when we use console.write/console.writeline, such as: Console.Write ("{0}", i);
The placeholder {0} must be zero-based and less than the parameter list size.
Can be Console.WriteLine ("{0}{4}", 6,9,9,2,4), so write, output 64.
Console.WriteLine ("{0:x5}{4}", 6,9,9,2,4); output 000064, note: X5
Ask the master to ask the binary press 8-bit output how to do? such as the binary 100 output to 00000100. How do I add 0 methods to a string without turning it???
GetType ():
Gets the type of the current instance. such as int i=1; Console.WriteLine (I.gettype ()); Output: System.Int32
GetTypeCode ():
Returns the underlying typecode of the instance.
var i = 1;if (I.gettypecode () ==typecode.int32.gettypecode ()) {...} is:
Represents a bool value
if (i is int) {...}
As
Object obj = new Object (); Creates a base class object.
Program P = obj as program; If obj (reference) is incompatible with the program class, the result is null.
if (p==null) {...}
The above is the C # supplements of the Small Knowledge (ii) of the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!