IKVM.Reflection.Type.GetMethod C# (CSharp) Method

GetMethod() public method

public GetMethod ( string name ) : IKVM.Reflection.MethodInfo
name string
return IKVM.Reflection.MethodInfo
        public MethodInfo GetMethod(string name)
        {
            return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
        }

Same methods

Type::GetMethod ( string name, BindingFlags bindingAttr ) : IKVM.Reflection.MethodInfo
Type::GetMethod ( string name, BindingFlags bindingAttr, IKVM.Reflection.Binder binder, CallingConventions callConvention, Type types, IKVM.Reflection.ParameterModifier modifiers ) : IKVM.Reflection.MethodInfo
Type::GetMethod ( string name, BindingFlags bindingAttr, IKVM.Reflection.Binder binder, Type types, IKVM.Reflection.ParameterModifier modifiers ) : IKVM.Reflection.MethodInfo
Type::GetMethod ( string name, Type types ) : IKVM.Reflection.MethodInfo
Type::GetMethod ( string name, Type types, IKVM.Reflection.ParameterModifier modifiers ) : IKVM.Reflection.MethodInfo

Usage Example

Example #1
0
        protected override void EmitRead(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
        {
            using (Compiler.Local oldValue = ctx.GetLocalWithValue(expectedType, valueFrom))
                using (Compiler.Local token = new Compiler.Local(ctx, ctx.MapType(typeof(SubItemToken))))
                    using (Compiler.Local field = new Compiler.Local(ctx, ctx.MapType(typeof(int))))
                    {
                        ctx.LoadReaderWriter();
                        ctx.EmitCall(ctx.MapType(typeof(ProtoReader)).GetMethod("StartSubItem"));
                        ctx.StoreValue(token);

                        Compiler.CodeLabel next = ctx.DefineLabel(), processField = ctx.DefineLabel(), end = ctx.DefineLabel();

                        ctx.MarkLabel(next);

                        ctx.EmitBasicRead("ReadFieldHeader", ctx.MapType(typeof(int)));
                        ctx.CopyValue();
                        ctx.StoreValue(field);
                        ctx.LoadValue(Tag); // = 1 - process
                        ctx.BranchIfEqual(processField, true);
                        ctx.LoadValue(field);
                        ctx.LoadValue(1); // < 1 - exit
                        ctx.BranchIfLess(end, false);

                        // default: skip
                        ctx.LoadReaderWriter();
                        ctx.EmitCall(ctx.MapType(typeof(ProtoReader)).GetMethod("SkipField"));
                        ctx.Branch(next, true);

                        // process
                        ctx.MarkLabel(processField);
                        if (Tail.RequiresOldValue)
                        {
                            if (expectedType.IsValueType)
                            {
                                ctx.LoadAddress(oldValue, expectedType);
                                ctx.EmitCall(expectedType.GetMethod("GetValueOrDefault", Helpers.EmptyTypes));
                            }
                            else
                            {
                                ctx.LoadValue(oldValue);
                            }
                        }
                        Tail.EmitRead(ctx, null);
                        // note we demanded always returns a value
                        if (expectedType.IsValueType)
                        {
                            ctx.EmitCtor(expectedType, Tail.ExpectedType); // re-nullable<T> it
                        }
                        ctx.StoreValue(oldValue);
                        ctx.Branch(next, false);

                        // outro
                        ctx.MarkLabel(end);

                        ctx.LoadValue(token);
                        ctx.LoadReaderWriter();
                        ctx.EmitCall(ctx.MapType(typeof(ProtoReader)).GetMethod("EndSubItem"));
                        ctx.LoadValue(oldValue); // load the old value
                    }
        }
All Usage Examples Of IKVM.Reflection.Type::GetMethod