C # basic (5) enumeration, array, and namespace

Source: Internet
Author: User

1. Enumeration

Enumeration is a user-defined Integer type. When declaring an enumeration type, you must specify a group of acceptable instance values that can be included in the enumeration.

=, Gread =, fatherAge =}

Let's look at another example:

=

Output gread. Enumeration will be instantiated in the background as a structure derived from System. Enum, which means you can call methods and perform some operations on it.

2. Array

Declaration method:

Int [] userCount; // int [] indicates an integer array.

Int [] userConut = new int [20]; // declares an integer array of 20.

Note that all arrays are of reference type.

3. namespace

Call the classes in the namespace:

Namespace. class name such as google.com. MyFirstClass

Alias the namespace: using google = google.com

The first question before each class is using System; this is because many classes in C # r are included in the System namespace.

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.