A little knowledge of C # supplements (ii)

Source: Internet
Author: User
Tags bitwise bitwise operators
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)!

  • Related Article

    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.