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


C# PropertyAttributes类代码示例

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


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

示例1: Create

 public static VirtualPropertyInfo Create(string name,
                                          Type declaringType,
                                          Type reflectedType,
                                          Type propertyType,
                                          PropertyAttributes attributes,
                                          bool readable,
                                          bool writable)
 {
     return
         internalizedCache.GetOrAdd(
             GetUniqueKey(declaringType, reflectedType, propertyType, readable, writable, name, attributes),
             key =>
             {
                 VirtualMethodInfo getterBaseDefinition = null;
                 VirtualPropertyInfo baseProperty = null;
                 if (declaringType != reflectedType)
                 {
                     baseProperty = Create(name, declaringType, declaringType, propertyType, attributes, readable,
                                           writable);
                     getterBaseDefinition = baseProperty.getMethod;
                 }
                 const MethodAttributes methodAttributes =
                     MethodAttributes.NewSlot | MethodAttributes.SpecialName |
                     MethodAttributes.HideBySig
                     | MethodAttributes.Virtual | MethodAttributes.Public;
                 var getter = new VirtualMethodInfo("get_" + name, declaringType, reflectedType, methodAttributes,
                                                    baseDefinition : getterBaseDefinition);
                 var prop = new VirtualPropertyInfo(name, declaringType, reflectedType, propertyType, getter,
                                                    null, attributes, baseProperty);
                 return prop;
             });
 }
开发者ID:Pomona,项目名称:Pomona,代码行数:32,代码来源:VirtualPropertyInfo.cs

示例2: PropertyInfoMirror

		public PropertyInfoMirror (TypeMirror parent, long id, string name, MethodMirror get_method, MethodMirror set_method, PropertyAttributes attrs) : base (parent.VirtualMachine, id) {
			this.parent = parent;
			this.name = name;
			this.attrs = attrs;
			this.get_method = get_method;
			this.set_method = set_method;
		}
开发者ID:shana,项目名称:Mono.Debugger.Soft,代码行数:7,代码来源:PropertyInfoMirror.cs

示例3: DefineProperty

 public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes)
 {
     var pb = _typeBuilder.DefineProperty(name, attributes, returnType, parameterTypes);
     _members.Add(pb);
     _paramsByMember.Add(pb, parameterTypes);
     return pb;
 }
开发者ID:davidvmckay,项目名称:ProxyFoo,代码行数:7,代码来源:FooTypeFromTypeBuilder.cs

示例4: PropertyEmitter

        // private ParameterInfo[] indexParameters;
        public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, String name, PropertyAttributes attributes,
		                       Type propertyType)
        {
            this.parentTypeEmitter = parentTypeEmitter;

            builder = parentTypeEmitter.TypeBuilder.DefineProperty(name, attributes, propertyType, new Type[0]);
        }
开发者ID:havard,项目名称:strongbind,代码行数:8,代码来源:PropertyEmitter.cs

示例5: MarshalAccessorProperty

 public MarshalAccessorProperty(int index, JsObject getter, JsObject setter, PropertyAttributes attributes)
 {
     Index = index;
     Getter = getter;
     Setter = setter;
     Attributes = attributes;
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:7,代码来源:MarshalAccessorProperty.cs

示例6: PropertyBuilder

 // Constructs a PropertyBuilder.  
 //
 internal PropertyBuilder(
     ModuleBuilder       mod,            // the module containing this PropertyBuilder
     String              name,           // property name
     SignatureHelper     sig,            // property signature descriptor info
     PropertyAttributes  attr,           // property attribute such as DefaultProperty, Bindable, DisplayBind, etc
     Type                returnType,     // return type of the property.
     PropertyToken       prToken,        // the metadata token for this property
     TypeBuilder         containingType) // the containing type
 {
     if (name == null)
         throw new ArgumentNullException("name");
     if (name.Length == 0)
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
     if (name[0] == '\0')
         throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name");
     Contract.EndContractBlock();
     
     m_name = name;
     m_moduleBuilder = mod;
     m_signature = sig;
     m_attributes = attr;
     m_returnType = returnType;
     m_prToken = prToken;
     m_tkProperty = prToken.Token;
     m_containingType = containingType;
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:28,代码来源:PropertyBuilder.cs

示例7: VirtualPropertyInfo

 internal VirtualPropertyInfo(string name,
                              Type declaringType,
                              Type reflectedType,
                              Type propertyType,
                              VirtualMethodInfo getMethod,
                              VirtualMethodInfo setMethod,
                              PropertyAttributes attributes,
                              VirtualPropertyInfo baseDefinition)
 {
     if (declaringType == null)
         throw new ArgumentNullException(nameof(declaringType));
     if (reflectedType == null)
         throw new ArgumentNullException(nameof(reflectedType));
     if (propertyType == null)
         throw new ArgumentNullException(nameof(propertyType));
     if (name == null)
         throw new ArgumentNullException(nameof(name));
     DeclaringType = declaringType;
     ReflectedType = reflectedType;
     PropertyType = propertyType;
     this.getMethod = getMethod;
     this.setMethod = setMethod;
     Name = name;
     Attributes = attributes;
     BaseDefinition = baseDefinition ?? this;
     MetadataToken = VirtualMemberMetadataTokenAllocator.AllocateToken();
 }
开发者ID:Pomona,项目名称:Pomona,代码行数:27,代码来源:VirtualPropertyInfo.cs

示例8: PropertyEmitter

		// private ParameterInfo[] indexParameters;

		public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, string name, PropertyAttributes attributes,
		                       Type propertyType, Type[] arguments)
		{
			this.parentTypeEmitter = parentTypeEmitter;

			// DYNPROXY-73 - AmbiguousMatchException for properties
			// This is a workaround for a framework limitation in CLR 2.0 
			// This limitation was removed in CLR 2.0 SP1, but we don't want to 
			// tie ourselves to that version. This perform the lookup for the new overload
			// dynamically, so we have a nice fallback on vanilla CLR 2.0

			if (TypeBuilderMethods.DefineProperty == null || true) // TODO
			{
				DefineProperty_Clr2_0 oldDefineProperty = parentTypeEmitter.TypeBuilder.DefineProperty;
				builder = oldDefineProperty(name, attributes, propertyType, arguments);
			}
			else
			{
				var newDefinedProperty = (DefineProperty_Clr_2_0_SP1)
				                         Delegate.CreateDelegate(typeof(DefineProperty_Clr_2_0_SP1),
				                                                 parentTypeEmitter.TypeBuilder,
				                                                 TypeBuilderMethods.DefineProperty);
				builder = newDefinedProperty(
					name, attributes, CallingConventions.HasThis, propertyType,
					null, null, arguments, null, null);
			}
		}
开发者ID:BiBongNet,项目名称:JustMockLite,代码行数:29,代码来源:PropertyEmitter.cs

示例9: PropertyBuilder

		internal PropertyBuilder(TypeBuilder typeBuilder, string name, PropertyAttributes attributes, PropertySignature sig, bool patchCallingConvention)
		{
			this.typeBuilder = typeBuilder;
			this.name = name;
			this.attributes = attributes;
			this.sig = sig;
			this.patchCallingConvention = patchCallingConvention;
		}
开发者ID:ngraziano,项目名称:mono,代码行数:8,代码来源:PropertyBuilder.cs

示例10: DefineProperty

 public void DefineProperty(object index, object value, PropertyAttributes attributes)
 {
     DefineProperty(
         _global.ResolveIdentifier(JsValue.ToString(index)),
         value,
         attributes
     );
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:8,代码来源:DictionaryPropertyStore.cs

示例11: MetadataPropertyInfo

		internal MetadataPropertyInfo (IMetadataImport importer, int propertyToken, MetadataType declaringType)
		{
			m_importer = importer;
			m_propertyToken = propertyToken;
			m_declaringType = declaringType;

			int mdTypeDef;
			int pchProperty;
			int pdwPropFlags;
			IntPtr ppvSig;
			int pbSig;
			int pdwCPlusTypeFlag;
			IntPtr ppDefaultValue;
			int pcchDefaultValue;
			int rmdOtherMethod;
			int pcOtherMethod;

			m_importer.GetPropertyProps (
				m_propertyToken,
				out mdTypeDef,
				null,
				0,
				out pchProperty,
				out pdwPropFlags,
				out ppvSig,
				out pbSig,
				out pdwCPlusTypeFlag,
				out ppDefaultValue,
				out pcchDefaultValue,
				out m_pmdSetter,
				out m_pmdGetter,
				out rmdOtherMethod,
				0,
				out pcOtherMethod);

			StringBuilder szProperty = new StringBuilder (pchProperty);
			m_importer.GetPropertyProps (
				m_propertyToken,
				out mdTypeDef,
				szProperty,
				pchProperty,
				out pchProperty,
				out pdwPropFlags,
				out ppvSig,
				out pbSig,
				out pdwCPlusTypeFlag,
				out ppDefaultValue,
				out pcchDefaultValue,
				out m_pmdSetter,
				out m_pmdGetter,
				out rmdOtherMethod,
				0,
				out pcOtherMethod);

			m_propAttributes = (PropertyAttributes) pdwPropFlags;
			m_name = szProperty.ToString ();
			MetadataHelperFunctions.GetCustomAttribute (importer, propertyToken, typeof (System.Diagnostics.DebuggerBrowsableAttribute));
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:58,代码来源:MetadataPropertyInfo.cs

示例12: PropertyEmitter

		public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, string name, PropertyAttributes attributes,
		                       Type propertyType, Type[] arguments)
		{
			this.parentTypeEmitter = parentTypeEmitter;

			builder = parentTypeEmitter.TypeBuilder.DefineProperty(
				name, attributes, CallingConventions.HasThis, propertyType,
				null, null, arguments, null, null);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:9,代码来源:PropertyEmitter.cs

示例13: Add

        public JsSchema Add(int index, PropertyAttributes attributes, ref object[] values, object value)
        {
            // The entry shouldn't be in our schema yet.
            Debug.Assert(GetOffset(index) < 0);

            // Get or create the new schema.
            JsSchema schema = null;

            // Check whether we already have a transformation.
            if (_transformations != null)
                schema = _transformations.GetValue(MakeIndex(index, attributes));

            int newOffset;

            // Build the new schema if we don't have it yet and add it to the
            // list of transformations.
            if (schema == null)
            {
                schema = new JsSchema(this);

                // Apply the mutation to the new schema. We get a free entry or,
                // if there isn't any, increase the array size.

                var freeList = schema._freeList;
                if (freeList == null)
                {
                    schema.GrowFreeEntries();
                    freeList = schema._freeList;
                }

                schema._freeList = freeList.Next;
                newOffset = freeList.Index;

                schema._node = new Node(true, index, attributes, newOffset, _node);

                if (_transformations == null)
                    _transformations = new SchemaTransformationHashSet(InitialTransformationsSize);

                _transformations.Add(MakeIndex(index, attributes), schema);
            }
            else
            {
                newOffset = schema.GetOffset(index);

                // The attributes of this property of the new schema should
                // be the same as what we're adding.
                Debug.Assert(schema.GetAttributes(index) == attributes);
            }

            // Apply the transformation to the values array.
            if (_arraySize != schema._arraySize)
                Array.Resize(ref values, schema._arraySize);

            values[newOffset] = value;

            return schema;
        }
开发者ID:pvginkel,项目名称:Jint2,代码行数:57,代码来源:JsSchema.cs

示例14: DefineProperty

 public void DefineProperty(int index, JsFunction @delegate, int argumentCount, PropertyAttributes attributes)
 {
     EnsurePropertyStore();
     PropertyStore.DefineProperty(
         index,
         Global.CreateFunction(Global.GetIdentifier(index), @delegate, argumentCount),
         attributes
     );
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:9,代码来源:JsObject.Properties.cs

示例15: DefineAccessor

 public void DefineAccessor(int index, JsObject getter, JsObject setter, PropertyAttributes attributes)
 {
     EnsurePropertyStore();
     PropertyStore.DefineProperty(
         index,
         new PropertyAccessor(getter, setter),
         attributes
     );
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:9,代码来源:JsObject.Properties.cs


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