}
}
.
#: 8475-09, : $9,800.00
PacketHeader , , . , PacketHeader , , . , PacketHeader , .
, C++ struct. , #. , C++ , , , . C# , .
. enum. :
enum { _ };
, _ , .
Apple .
enum Apple { Jonathan, GoldenDel, RedDel, Winesap,
Cortland, McIntosh };
, . C# , , . , . , , , switch for.
, , . . , Apple Jonathan , GoldenDel 1, RedDel 2 ..
, -. ,
Console.WriteLine(Apple.RedDel + " " +
(int)Apple.RedDel);
.
RedDel 2
, . int.
|
|
, Apple.
11 .
Using System;
class EnumDemo {
enum Apple { Jonathan, GoldenDel, RedDel, Winesap,
Cortland, McIntosh };
static void Main() { string[] color = {
"",
"",
"",
"",
"",
"-"
};
Apple i; 11
// i
// .
for(i = Apple.Jonathan; i <= Apple.McIntosh; i++)
Console.WriteLine(i + " " + (int)i);
Console.WriteLine ();
// . for(i = Apple.Jonathan; i <= Apple.McIntosh; i++)
Console.WriteLine(" " + i + " " + color[ (int)i]);
}
}