private void GenerateTargetProperty()
        {
            EasyProperty property  = CreateProperty("Target", typeof(object));
            EasyMethod   getMethod = property.CreateGetMethod();

            MethodInfo baseMethod = typeof(MulticastDelegate).GetMethod("get_Target");

            getMethod.CodeBuilder.AddStatement(
                new ReturnStatement(new MethodInvocationExpression(baseMethod)));

//			PropertyAttributes patts = PropertyAttributes.None;
//			PropertyBuilder pbuilder = _delegateBuilder.DefineProperty("Target", patts, typeof(Object), null);
//
//			MethodAttributes atts = MethodAttributes.Public|MethodAttributes.Virtual|MethodAttributes.SpecialName;
//			MethodBuilder methodBuilder = _delegateBuilder.DefineMethod("get_Target",
//				atts, CallingConventions.Standard, typeof(object), new Type[0]);
//
//			ILGenerator gen = methodBuilder.GetILGenerator();
//
//			gen.DeclareLocal( typeof(object) );
//			gen.Emit(OpCodes.Ldarg_0);
//			gen.Emit(OpCodes.Call, typeof(MulticastDelegate).GetMethod("get_Target"));
//			gen.Emit(OpCodes.Stloc_0);
//			gen.Emit(OpCodes.Ldloc_0);
//			gen.Emit(OpCodes.Ret);
//
//			pbuilder.SetGetMethod(methodBuilder);
        }
Exemple #2
0
        public EasyProperty CreateProperty(String name, Type returnType)
        {
            EasyProperty prop = new EasyProperty(this, name, returnType);

            _properties.Add(prop);
            return(prop);
        }
Exemple #3
0
        public EasyProperty CreateProperty(PropertyInfo property)
        {
            EasyProperty prop = new EasyProperty(this, property.Name, property.PropertyType);

            prop.IndexParameters = property.GetIndexParameters();
            _properties.Add(prop);
            return(prop);
        }
 public void Add(EasyProperty property)
 {
     InnerList.Add(property);
 }