作者:.NET开发
项目:System.ComponentMode
[TypeConverter(typeof(MyClassConverter))]
public class MyClass {
// Insert code here.
}
作者:.NET开发
项目:System.ComponentMode
public MyPropertyEnum MyProperty {
set {
// Checks to see if the value passed is valid.
if (!TypeDescriptor.GetConverter(typeof(MyPropertyEnum)).IsValid(value)) {
throw new ArgumentException();
}
// The value is valid. Insert code to set the property.
}
}
作者:.NET开发
项目:System.ComponentMode
foreach(Color c in TypeDescriptor.GetConverter(typeof(Color)).GetStandardValues()) {
Console.WriteLine(TypeDescriptor.GetConverter(c).ConvertToString(c));
}