The "1" enumeration and structure of the net base of the evil complement

Source: Internet
Author: User

Sometimes we want the variable to fetch a value from a fixed set, and then we can use the enumeration type.

Cases:

enumOpenMode:byte{New=1, edit=2, view=3    }    classProgram {Static voidMain (string[] args) {OpenMode OpenMode=OpenMode. Added; Console.WriteLine ("myorientation = {0}", OpenMode);        Console.readkey (); }    }

The print result is typed, adding these two words instead of numbers.

That is, when an enumeration is instantiated, its value is defined as the part preceding the medium equal sign, and the part following the equal sign indicates.

struct keywords are structs.

Struct really does not need to have an example, a struct is a class that indicates that it is a class of value type. The value type is on the stack, and the instance of the class is on the heap.

It can be understood that the struct is a lightweight class.

The "1" enumeration and structure of the net base of the evil complement

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.