Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public EasyProperty CreateProperty(String name, Type returnType)
        {
            EasyProperty prop = new EasyProperty(this, name, returnType);

            _properties.Add(prop);
            return(prop);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public void Add(EasyProperty property)
 {
     InnerList.Add(property);
 }