2015/4/9 Data Conversion Array Enumeration/c# Learning notes

Source: Internet
Author: User

Using System;
Class Studenthomework
{
public enum Friends
{boss, Dick, old Three, old four, old five, old six};
public static void Main ()
{
Friends f1 = Friends. Boss;
Friends F2 = Friends. Dick;
Friends F3 = Friends. Old Three;
Friends f4 = Friends. Old Four;
string[] family = new String[6];
Family[0] = "Aunt";
FAMILY[1] = "two aunts";
FAMILY[2] = "three aunts";
Family[3] = "Aunt";
Console.WriteLine ("This is my circle of friends: 1.friends,2.classmate,3.family,4.coupling");
Console.Write ("Please select:");
for (int j = 1; J <= 5; j + +)
{
string s = Console.ReadLine ();
int n = Int. Parse (s);
Switch (n)
{
Case 1:
Console.WriteLine (F1. ToString () + "," + F2. ToString () + "," + F3. ToString () + "," + F4. ToString ());
Break
Case 2:
Console.WriteLine ("Mason, fenbing, Zhang Mengting, Yang Mingzhu, Trichon");
Break
Case 3:
Console.WriteLine (Family[0] + "," + family[1] + "," + family[2] + "," + family[3]);
Break
Case 4:
Console.WriteLine ("Xiaoming, Xiao Ming");
Break
Default
Console.WriteLine ("No");
Break
int[] Array1 = new int[] {1, 2, 3, 4};
for (int i = 0; i < array1.length; i++)
//{
Console.WriteLine (i);
//}
}

}
}

}

Enumeration:

enum{element 1, Element 2};

1. Enumerations are constants, not variables, and can no longer be assigned during use

2. The enumeration element itself is defined by the system as a numeric value representing the ordinal. The order from the 0 start is defined as 0,1,2 ....

Array (one-dimensional):

Define an array:

Int[]sz=new Int[5];

Int[]sz=new int[3]{1,2,3}


2015/4/9 Data Conversion Array Enumeration/c# Learning notes

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.