Small knowledge (2), small knowledge
Bitwise OPERATOR:
And: & when the binary bits are both 1, the result is 1, otherwise 0. Binary calculation, by-bit comparison.
Or: | if the binary bit is 0, the result is 0. Otherwise, 1 is returned. Binary calculation, by-bit comparison.
XOR: ^ if the binary phase is the same, the result is 0. Otherwise, 1 is returned. Binary calculation, by-bit comparison.
Reverse :~ If the binary value is 0, the result is 1. Otherwise, the value is 0. One-dimensional calculation, by-bit comparison.
Left shift: <equivalent to n power of 2. Binary operation.
Right Shift:> is equivalent to n power except 2. Binary operation.
Logical operators:
Or: | if both bool values are false, the result is false. Otherwise, the result is true. Binary operation.
Non-logical :! If it is false, the result is true. Unary operation.
When both the logical and: & and bool values are true, the result is true; otherwise, false. Binary operation.
Placeholder:
Placeholders are often used when we use Console. Write/Console. WriteLine, such as Console. write ("{0}", I );
The placeholder {0} must start from scratch and be smaller than the parameter list size.
You can use Console. WriteLine ("{0} {4}", 6, 9, 9, 2, 4); in this way, output 64.
Console. WriteLine ("{0: x5} {4}", 6, 9, 9, 2, 4); Output 000064, note: x5
Ask the master to ask how to do binary output by 8 bits? For example, binary 100 is output to 00000100. You do not need to add the 0 method before string Conversion. How can this problem be solved ???
GetType ():
Obtain the type of the current instance. For example, int I = 1; Console. WriteLine (I. GetType (); output: System. Int32
GetTypeCode ():
Returns the basic TypeCode of the instance.
Var I = 1;
If (I. GetTypeCode () = TypeCode. Int32.GetTypeCode ())
{......}
Is:
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 not compatible with the Program class, the result is null.
If (p = null)
{......}