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