zoukankan      html  css  js  c++  java
  • 反射学习.

    1.GetType() :

      XXXObject object;

       Object.GetType(); 不管XXXObject是那一级别,GetType始终返回最末一级的类型.

    2.GetMeath():返回基类,子类的所有方法.

     

    代码
                    MethodInfo beforeCopy = newObject.GetType().GetMethod("BeforeCopy");
                    
    if (beforeCopy != null)
                    {
                        beforeCopy.Invoke(newObject, 
    null);
                    }

     3.GetProperty


                var property 
    = obj.GetType().GetProperty(propertyName);            
                
    return property.GetValue(obj, null);
  • 相关阅读:
    OCR中表格识别及WORD生成
    太阳能跟踪系统
    QA300太阳能移动电源
    OCR之表格识别
    2012112
    2012123
    2012121
    2011101
    201191
    2011828
  • 原文地址:https://www.cnblogs.com/SouthAurora/p/1721095.html
Copyright © 2011-2022 走看看