csharp System.ComponentModel.TypeConverterAttribute类(方法)实例源码

下面列出了csharp System.ComponentModel.TypeConverterAttribute 类(方法)源码代码实例,从而了解它的用法。

作者:.NET开发    项目:System.ComponentMode   
[TypeConverter(typeof(MyClassConverter))]
 public class MyClass {
    // Insert code here.
 }

作者:.NET开发    项目:System.ComponentMode   
public static int Main() {
    // Creates a new instance of MyClass.
    MyClass myNewClass = new MyClass();
 
    // Gets the attributes for the instance.
    AttributeCollection attributes = TypeDescriptor.GetAttributes(myNewClass);
 
    /* Prints the name of the type converter by retrieving the 
     * TypeConverterAttribute from the AttributeCollection. */
    TypeConverterAttribute myAttribute = 
        (TypeConverterAttribute)attributes[typeof(TypeConverterAttribute)];
    
    Console.WriteLine("The type conveter for this class is: " + 
        myAttribute.ConverterTypeName);
 
    return 0;
 }


问题


面经


文章

微信
公众号

扫码关注公众号