当前位置: 首页>>代码示例>>C#>>正文


C# Reflection.MethodInfo类代码示例

本文整理汇总了C#中System.Reflection.MethodInfo的典型用法代码示例。如果您正苦于以下问题:C# System.Reflection.MethodInfo类的具体用法?C# System.Reflection.MethodInfo怎么用?C# System.Reflection.MethodInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Reflection.MethodInfo类属于命名空间,在下文中一共展示了System.Reflection.MethodInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DispatchExceptionFailureEventArgs

 public DispatchExceptionFailureEventArgs(Exception ex, IQHsm hsm, System.Reflection.MethodInfo stateMethod, IQEvent ev)
 {
     _Exception = ex;
     _Hsm = hsm;
     _StateMethod = stateMethod;
     _OriginalEvent = ev;
 }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:7,代码来源:DispatchExceptionFailureEventArgs.cs

示例2: ProcessParams

 public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     Attribute attribute = parameter.GetCustomAttributeByReflection<DescriptionAttribute>();
     if (attribute == null) {
         attribute = parameter.GetCustomAttributeByReflection<DescribedAsAttribute>();
     }
     return FacetUtils.AddFacet(Create(attribute, holder));
 }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:DescribedAsAnnotationFacetFactory.cs

示例3: Process

        public override bool Process(MethodInfo method, IMethodRemover methodRemover, IFacetHolder holder) {
            var classAttribute = method.DeclaringType.GetCustomAttributeByReflection<AuthorizeActionAttribute>();
            var methodAttribute = method.GetCustomAttribute<AuthorizeActionAttribute>();

            if (classAttribute != null && methodAttribute != null) {
                Log.WarnFormat("Class and method level AuthorizeAttributes applied to class {0} - ignoring attribute on method {1}", method.DeclaringType.FullName, method.Name);
            }

            return Create(classAttribute ?? methodAttribute, holder);
        }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:10,代码来源:AuthorizeAnnotationFacetFactory.cs

示例4: BuildAccessor

        private static System.Func<object, object> BuildAccessor(MethodInfo method)
        {
            ParameterExpression obj = Expression.Parameter(typeof(object), "obj");
            UnaryExpression instance = !method.IsStatic ? Expression.Convert(obj, method.DeclaringType) : null;
            Expression<System.Func<object, object>> expr = Expression.Lambda<System.Func<object, object>>(
                Expression.Convert(
                    Expression.Call(instance, method),
                    typeof(object)),
                obj);

            return expr.Compile();
        }
开发者ID:antlr,项目名称:antlrcs,代码行数:12,代码来源:ObjectModelAdaptor.cs

示例5: MdaMethodImpl

        // ------------------------------------------------------------------------
        //    private final MdaClass parentMdaClass;  .. see super
        //    private final String methodName; .. see super.getName
        // constructors
        // -------------------------------------------------------------------------
        public MdaMethodImpl(MdaClass parentMdaClass, int internalMethodIndex, 
		                     System.Reflection.MethodInfo method, PropertiesNode tags)
            : base(method.Name, tags, parentMdaClass)
        {
            this.internalMethodIndex = internalMethodIndex;
            this.method = method;
            this.returnType = method.ReturnType;
            if (returnType == null)
            {
                throw new System.InvalidOperationException("returnType == null for Method " + this);
            }
        }
开发者ID:Arnaud-Nauwynck,项目名称:test-dotnet-snippets,代码行数:17,代码来源:MdaMethodImpl.cs

示例6: Message

        public Message(MessageID msgid, string msgname, Int16 length, List<Byte> msgargtypes, System.Reflection.MethodInfo msghandler)
        {
            id = msgid;
            name = msgname;
            msglen = length;
            handler = msghandler;

            argtypes = new System.Reflection.MethodInfo[msgargtypes.Count];
            for(int i=0; i<msgargtypes.Count; i++)
            {
                argtypes[i] = StreamRWBinder.bindReader(msgargtypes[i]);
                if(argtypes[i] == null)
                {
                    Dbg.ERROR_MSG("Message::Message(): bindReader(" + msgargtypes[i] + ") is error!");
                }
            }

            // Dbg.DEBUG_MSG(string.Format("Message::Message(): ({0}/{1}/{2})!",
            //	msgname, msgid, msglen));
        }
开发者ID:hellopcworld,项目名称:kbengine,代码行数:20,代码来源:Message.cs

示例7: Process

        public override bool Process(MethodInfo actionMethod, IMethodRemover methodRemover, IFacetHolder action) {
            string capitalizedName = NameUtils.CapitalizeName(actionMethod.Name);

            Type type = actionMethod.DeclaringType;
            var facets = new List<IFacet>();
            INakedObjectSpecification onType = Reflector.LoadSpecification(type);
            INakedObjectSpecification returnSpec = Reflector.LoadSpecification(actionMethod.ReturnType);

            RemoveMethod(methodRemover, actionMethod);
            facets.Add(new ActionInvocationFacetViaMethod(actionMethod, onType, returnSpec, action));

            MethodType methodType = actionMethod.IsStatic ? MethodType.Class : MethodType.Object;
            Type[] paramTypes = actionMethod.GetParameters().Select(p => p.ParameterType).ToArray();
            FindAndRemoveValidMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);

            DefaultNamedFacet(facets, capitalizedName, action); // must be called after the checkForXxxPrefix methods

            AddHideForSessionFacetNone(facets, action);
            AddDisableForSessionFacetNone(facets, action);
            FindDefaultHideMethod(facets, methodRemover, type, methodType, "ActionDefault", paramTypes, action);
            FindAndRemoveHideMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);
            FindDefaultDisableMethod(facets, methodRemover, type, methodType, "ActionDefault", paramTypes, action);
            FindAndRemoveDisableMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);

            if (action is DotNetNakedObjectActionPeer) {
                var nakedObjectActionPeer = (DotNetNakedObjectActionPeer) action;
                // Process the action's parameters names, descriptions and optional
                // an alternative design would be to have another facet factory processing just ActionParameter, and have it remove these
                // supporting methods.  However, the FacetFactory API doesn't allow for methods of the class to be removed while processing
                // action parameters, only while processing Methods (ie actions)
                INakedObjectActionParamPeer[] actionParameters = nakedObjectActionPeer.Parameters;
                string[] paramNames = actionMethod.GetParameters().Select(p => p.Name).ToArray();

                FindAndRemoveParametersAutoCompleteMethod(methodRemover, type, capitalizedName, paramTypes, actionParameters);
                FindAndRemoveParametersChoicesMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
                FindAndRemoveParametersDefaultsMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
                FindAndRemoveParametersValidateMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
            }
            return FacetUtils.AddFacets(facets);
        }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:40,代码来源:ActionMethodsFacetFactory.cs

示例8: Message

        public Message(MessageID msgid, string msgname, Int16 length, sbyte argstype, List<Byte> msgargtypes, System.Reflection.MethodInfo msghandler)
        {
            id = msgid;
            name = msgname;
            msglen = length;
            handler = msghandler;
            argsType = argstype;

            // 对该消息的所有参数绑定反序列化方法,改方法能够将二进制流转化为参数需要的值
            // 在服务端下发消息数据时会用到
            argtypes = new KBEDATATYPE_BASE[msgargtypes.Count];
            for(int i=0; i<msgargtypes.Count; i++)
            {
                if(!EntityDef.id2datatypes.TryGetValue(msgargtypes[i], out argtypes[i]))
                {
                    Dbg.ERROR_MSG("Message::Message(): argtype(" + msgargtypes[i] + ") is not found!");
                }
            }

            // Dbg.DEBUG_MSG(string.Format("Message::Message(): ({0}/{1}/{2})!",
            //	msgname, msgid, msglen));
        }
开发者ID:jiangzhuo,项目名称:kbengine_dotnet,代码行数:22,代码来源:Message.cs

示例9: DisplayMethodProperties

        public void DisplayMethodProperties(System.Reflection.MethodInfo Method)
        {
            ThisMethod = Method;

            // Show the method name

            Label2.Text = ThisMethod.Name;

            // Show the calling convention

            Label4.Text = "0x" + ThisMethod.CallingConvention.ToString("x") +
                " = " + ThisMethod.CallingConvention.ToString();

            // Show the method's standard attributes

            Label6.Text = "0x" + ThisMethod.Attributes.ToString("x") +
                " = " + ThisMethod.Attributes.ToString();

            // Show the return type

            Label8.Text = ThisMethod.ReturnType.FullName;

            // Show the parameters

            foreach (System.Reflection.ParameterInfo parm in ThisMethod.GetParameters())
            {
                //ListBox1.Items.Add(parm.Name + " as " + parm.ParameterType.FullName);
                ListBox1.Items.Add(parm.ParameterType);//changed because I need the type later
            }

            // Show the custom attributes

            foreach (object attr in ThisMethod.GetCustomAttributes(true))
            {
                ListBox2.Items.Add(attr);
            }
        }
开发者ID:dust2098,项目名称:e33-dispatcher-application,代码行数:37,代码来源:frmDisplayMethod.cs

示例10: Bridge

 public Bridge()
 {
     this.lDomain = System.AppDomain.CurrentDomain;
     this.LoadTypes();
     this.lTimeout = 30000;
     lHandleEventMethod = this.GetType().GetMethod("HandleEvent");
     this.timerhotkey = new System.Timers.Timer(100);
     this.timerhotkey.Elapsed += new System.Timers.ElapsedEventHandler(TimerCheckHotKey);
     AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
     System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
 }
开发者ID:a711960,项目名称:net-com-bridge,代码行数:11,代码来源:Bridge.cs

示例11: Init

 public override void Init(Reactor reactor)
 {
     base.Init(reactor);
     var cm = reactor.FindMethod (functionName);
     if (cm == null) {
         Debug.LogError ("Could not load function method: " + functionName);
     } else {
         component = cm.component;
         methodInfo = cm.methodInfo;
     }
 }
开发者ID:s76,项目名称:testAI,代码行数:11,代码来源:Function.cs

示例12: ObjectBusMessageDeserializerAttribute

 public ObjectBusMessageDeserializerAttribute(Type type, string funcName)
 {
     if (funcName == null)
         throw new ArgumentNullException ("funcName");
     func = type.GetMethod (funcName, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
     if (func == null) {
         Console.Write ("ObjectBusMessageDeserializerAttribute is going into failsafe mode, ");
         func = type.GetMethod (funcName, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
         if (func == null)
             Console.WriteLine ("failed.");
         else
             Console.WriteLine ("succeeded.");
     }
 }
开发者ID:vebin,项目名称:BD2,代码行数:14,代码来源:ObjectBusMessageDeserializerAttribute.cs

示例13: SnowballFilter

		/// <summary>Construct the named stemming filter.
		/// 
		/// </summary>
		/// <param name="in">the input tokens to stem
		/// </param>
		/// <param name="name">the name of a stemmer
		/// </param>
		public SnowballFilter(TokenStream in_Renamed, System.String name) : base(in_Renamed)
		{
			try
			{
				System.Type stemClass = System.Type.GetType("SF.Snowball.Ext." + name + "Stemmer");
				stemmer = (SnowballProgram) System.Activator.CreateInstance(stemClass);
				// why doesn't the SnowballProgram class have an (abstract?) stem method?
				stemMethod = stemClass.GetMethod("Stem", (new System.Type[0] == null) ? new System.Type[0] : (System.Type[]) new System.Type[0]);
			}
			catch (System.Exception e)
			{
				throw new System.SystemException(e.ToString());
			}
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:21,代码来源:SnowballFilter.cs

示例14: Init

 public override void Init(Reactor reactor)
 {
     base.Init(reactor);
     var cm = reactor.FindMethod(conditionMethod);
     if(cm == null) {
         Debug.LogError("Could not load condition method: " + conditionMethod);
     } else {
         if(cm.methodInfo.ReturnType == typeof(bool)) {
             component = cm.component;
             methodInfo = cm.methodInfo;
         } else {
             Debug.LogError("Condition method has invalid signature: " + conditionMethod);
         }
     }
 }
开发者ID:s76,项目名称:testAI,代码行数:15,代码来源:If.cs

示例15: ExecCmd

 static ExecCmd()
 {
     {
     // Runtime.exec(String[] cmdArr, String[] envArr, File currDir)
     Type[] parameterTypes = new Type[] { typeof( string[] ), typeof( string[] ), typeof( FileInfo ) };
     try
     {
       execMethod = System.Diagnostics.Process.GetCurrentProcess().GetType().GetMethod( "exec", (System.Type[])parameterTypes );
     }
     catch ( System.MethodAccessException e )
     {
       execMethod = null;
     }
       }
 }
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:15,代码来源:ExecCmd.cs


注:本文中的System.Reflection.MethodInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。