using
System;
using System.Collections.Generic;
using System.Text;
namespace Color
... {
class Program
...{
static void Main(string[] args)
...{
Color cc = Color.Red;
System.Console.WriteLine("The " + cc.GetType() + " type is drived from " + cc.GetType().BaseType);
//第一种方法参数是int类型 传输一个数字1
method1(1);
//第二种方法是重载了的类型是Color
method1(cc);
Color cs = Color.Red;
System.Console.WriteLine("Does cc equals cs: " + cc.Equals(cs));
switch (cs)
...{
case Color.Red:
System.Console.WriteLine("the color is " + cs);
break;
case Color.Green:
System.Console.WriteLine("the color is " + cs);
break;
case Color.Blue:
System.Console.WriteLine("the color is " + cs);
break;
default:
System.Console.WriteLine("should never come here");
break;
}
}
public enum Color ...{
Red,
Green,
Blue
}
public static void method1(int i)
...{
System.Console.WriteLine(i);
}
public static void method1(Color c)
...{
System.Console.WriteLine(c);
}
}
}
using System.Collections.Generic;
using System.Text;
namespace Color
... {
class Program
...{
static void Main(string[] args)
...{
Color cc = Color.Red;
System.Console.WriteLine("The " + cc.GetType() + " type is drived from " + cc.GetType().BaseType);
//第一种方法参数是int类型 传输一个数字1
method1(1);
//第二种方法是重载了的类型是Color
method1(cc);
Color cs = Color.Red;
System.Console.WriteLine("Does cc equals cs: " + cc.Equals(cs));
switch (cs)
...{
case Color.Red:
System.Console.WriteLine("the color is " + cs);
break;
case Color.Green:
System.Console.WriteLine("the color is " + cs);
break;
case Color.Blue:
System.Console.WriteLine("the color is " + cs);
break;
default:
System.Console.WriteLine("should never come here");
break;
}
}
public enum Color ...{
Red,
Green,
Blue
}
public static void method1(int i)
...{
System.Console.WriteLine(i);
}
public static void method1(Color c)
...{
System.Console.WriteLine(c);
}
}
}