Helper class for defining default properties
Inheritance: Yea.Reflection.Emit.BaseClasses.VariableBase, IPropertyBuilder
Esempio n. 1
0
        /// <summary>
        ///     Creates a default property (ex int Property{get;set;}
        /// </summary>
        /// <param name="name">name of the property</param>
        /// <param name="propertyType">Type of the property</param>
        /// <param name="attributes">attributes for the property (special name, etc.)</param>
        /// <param name="getMethodAttributes">Get method's attributes (public, private, etc.)</param>
        /// <param name="setMethodAttributes">Set method's attributes (public, private, etc.)</param>
        /// <param name="parameters">Parameter types</param>
        /// <returns>Property builder for the property</returns>
        public virtual IPropertyBuilder CreateDefaultProperty(string name, Type propertyType,
                                                              PropertyAttributes attributes =
                                                              PropertyAttributes.SpecialName,
                                                              MethodAttributes getMethodAttributes =
                                                              MethodAttributes.Public | MethodAttributes.Virtual,
                                                              MethodAttributes setMethodAttributes =
                                                              MethodAttributes.Public | MethodAttributes.Virtual,
                                                              IEnumerable <Type> parameters = null)
        {
            var returnValue = new DefaultPropertyBuilder(this, name, attributes,
                                                         getMethodAttributes, setMethodAttributes, propertyType,
                                                         parameters);

            Properties.Add(returnValue);
            return(returnValue);
        }
Esempio n. 2
0
 /// <summary>
 ///     Creates a default property (ex int Property{get;set;}
 /// </summary>
 /// <param name="name">name of the property</param>
 /// <param name="propertyType">Type of the property</param>
 /// <param name="attributes">attributes for the property (special name, etc.)</param>
 /// <param name="getMethodAttributes">Get method's attributes (public, private, etc.)</param>
 /// <param name="setMethodAttributes">Set method's attributes (public, private, etc.)</param>
 /// <param name="parameters">Parameter types</param>
 /// <returns>Property builder for the property</returns>
 public virtual IPropertyBuilder CreateDefaultProperty(string name, Type propertyType,
                                                       PropertyAttributes attributes =
                                                           PropertyAttributes.SpecialName,
                                                       MethodAttributes getMethodAttributes =
                                                           MethodAttributes.Public | MethodAttributes.Virtual,
                                                       MethodAttributes setMethodAttributes =
                                                           MethodAttributes.Public | MethodAttributes.Virtual,
                                                       IEnumerable<Type> parameters = null)
 {
     var returnValue = new DefaultPropertyBuilder(this, name, attributes,
                                                  getMethodAttributes, setMethodAttributes, propertyType,
                                                  parameters);
     Properties.Add(returnValue);
     return returnValue;
 }