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


C# ComponentModel.AttributeCollection类代码示例

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


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

示例1: OutputAttributes

 private static void OutputAttributes(AttributeCollection attributeCollection)
 {
     foreach (Attribute attribute in attributeCollection)
     {
         Console.WriteLine("Attribute: {0}", attribute.ToString());
     }
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:7,代码来源:ProgrammingMetadataStore.cs

示例2:

		AttributeCollection ICustomTypeDescriptor.GetAttributes()
		{
			if (_attributes == null)
				_attributes = _typeDescriptionProvider.GetAttributes();

			return _attributes;
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:7,代码来源:CustomTypeDescriptorImpl.cs

示例3: AttributesContainer

        /// <summary>
        /// Initializes a new instance of the <see cref="AttributesContainer"/> class.
        /// </summary>
        /// <param name="attributes">The collection of attributes.</param>
        public AttributesContainer(AttributeCollection attributes)
        {
            if (attributes == null) throw new ArgumentNullException("attributes");

            this.attributes = attributes;

            foreach (Type type in from Attribute attr in this.attributes select attr.GetType())
                RegisterAttribute(type.Name, type);
        }
开发者ID:denkhaus,项目名称:WPG,代码行数:13,代码来源:AttributesContainer.cs

示例4: GetEditorAttribute

		/// <summary>
		/// Returns the EditorAttribute in the AttributeCollection.
		/// </summary>
		public static EditorAttribute GetEditorAttribute(AttributeCollection attributes)
		{
			foreach (Attribute attribute in attributes) {
				EditorAttribute editorAttribute = attribute as EditorAttribute;
				if (editorAttribute != null) {
					return editorAttribute;
				}
			}
			return null;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:13,代码来源:WixBindingTestsHelper.cs

示例5: CanGetEditorAttributeFromCollection

		public void CanGetEditorAttributeFromCollection()
		{
			BindableAttribute bindableAttribute = new BindableAttribute(false);
			EditorAttribute editorAttribute = new EditorAttribute();
			
			Attribute[] attributes = new Attribute[] { bindableAttribute, editorAttribute };
			AttributeCollection attributeCollection = new AttributeCollection(attributes);
			
			Assert.AreSame(editorAttribute, WixBindingTestsHelper.GetEditorAttribute(attributeCollection));
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:10,代码来源:WixBindingTestsHelperTests.cs

示例6: FromExisting

		public static AttributeCollection FromExisting (AttributeCollection existing, params Attribute [] newAttributes)
		{
			if (existing == null)
				throw new ArgumentNullException ("existing");
			AttributeCollection ret = new AttributeCollection ();
			ret.attrList.AddRange (existing.attrList);
			if (newAttributes != null)
				ret.attrList.AddRange (newAttributes);
			return ret;
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:10,代码来源:AttributeCollection.cs

示例7: frmSettings_Load

        private void frmSettings_Load(object sender, EventArgs e)
        {
            System.Configuration.UserScopedSettingAttribute userAttr = new System.Configuration.UserScopedSettingAttribute();
              System.ComponentModel.AttributeCollection attrs = new System.ComponentModel.AttributeCollection(userAttr);

              propertyGrid1.BrowsableAttributes = attrs;
              propertyGrid1.SelectedObject = Properties.Settings.Default;

              cboCompany.Items.AddRange(hc.getAllCompanies());
        }
开发者ID:jobre,项目名称:Patiento-versikt,代码行数:10,代码来源:frmSettings.cs

示例8: CheckAndAddProperty

 private void CheckAndAddProperty(PSPropertyInfo propertyInfo, Attribute[] attributes, ref PropertyDescriptorCollection returnValue)
 {
     using (typeDescriptor.TraceScope("Checking property \"{0}\".", new object[] { propertyInfo.Name }))
     {
         if (!propertyInfo.IsGettable)
         {
             typeDescriptor.WriteLine("Property \"{0}\" is write-only so it has been skipped.", new object[] { propertyInfo.Name });
         }
         else
         {
             AttributeCollection propertyAttributes = null;
             Type propertyType = typeof(object);
             if ((attributes != null) && (attributes.Length != 0))
             {
                 PSProperty property = propertyInfo as PSProperty;
                 if (property != null)
                 {
                     DotNetAdapter.PropertyCacheEntry adapterData = property.adapterData as DotNetAdapter.PropertyCacheEntry;
                     if (adapterData == null)
                     {
                         typeDescriptor.WriteLine("Skipping attribute check for property \"{0}\" because it is an adapted property (not a .NET property).", new object[] { property.Name });
                     }
                     else if (property.isDeserialized)
                     {
                         typeDescriptor.WriteLine("Skipping attribute check for property \"{0}\" because it has been deserialized.", new object[] { property.Name });
                     }
                     else
                     {
                         propertyType = adapterData.propertyType;
                         propertyAttributes = adapterData.Attributes;
                         foreach (Attribute attribute in attributes)
                         {
                             if (!propertyAttributes.Contains(attribute))
                             {
                                 typeDescriptor.WriteLine("Property \"{0}\" does not contain attribute \"{1}\" so it has been skipped.", new object[] { property.Name, attribute });
                                 return;
                             }
                         }
                     }
                 }
             }
             if (propertyAttributes == null)
             {
                 propertyAttributes = new AttributeCollection(new Attribute[0]);
             }
             typeDescriptor.WriteLine("Adding property \"{0}\".", new object[] { propertyInfo.Name });
             PSObjectPropertyDescriptor descriptor = new PSObjectPropertyDescriptor(propertyInfo.Name, propertyType, !propertyInfo.IsSettable, propertyAttributes);
             descriptor.SettingValueException += this.SettingValueException;
             descriptor.GettingValueException += this.GettingValueException;
             returnValue.Add(descriptor);
         }
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:53,代码来源:PSObjectTypeDescriptor.cs

示例9: AddDisplayName

        internal static AttributeCollection AddDisplayName(string name, AttributeCollection attributes) {
            var displayNameAttrib = attributes.OfType<DisplayNameAttribute>().FirstOrDefault();

            // If there is already a display name attribute, don't change anything
            if (displayNameAttrib != null) {
                return attributes;
            }

            // Add a friendlier display name attribute
            return AttributeCollection.FromExisting(
                attributes,
                new DisplayNameAttribute(MakeFriendlyName(name)));
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:13,代码来源:CustomMetaColumn.cs

示例10: DeleteNonRelevatAttributes

        public static AttributeCollection DeleteNonRelevatAttributes(AttributeCollection collection)
        {
            ArrayList attributes = GetAttributes(collection);

            ArrayList newAttributes = new ArrayList();
            foreach (Attribute attr in attributes)
            {
                if (acceptableAttributes.ContainsKey(attr.GetType())
                    || acceptableAttributes.ContainsKey(attr.GetType().BaseType))
                {
                    newAttributes.Add(attr);
                }
            }
            return GetAttributes(newAttributes);
        }
开发者ID:KillerGoldFisch,项目名称:GCharp,代码行数:15,代码来源:AttributeUtils.cs

示例11: OnAddingAttribute

        /// <summary>
        /// 添加标签属性时的触发事件函数.用于设置自身的某些属性值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnAddingAttribute(object sender, AttributeCollection.AttributeAddingEventArgs e)
        {
            string name = e.Item.Name.ToLower();

            switch (name)
            {
                case "id":
                    this.Id = e.Item.Text.Trim();
                    break;
                case "name":
                    this.Name = e.Item.Text.Trim();
                    break;
            }
            OnAddingAttribute(name, e.Item);
        }
开发者ID:wujiang1984,项目名称:WechatBuilder,代码行数:20,代码来源:Tag.cs

示例12: FromExisting

 public static AttributeCollection FromExisting(AttributeCollection existing, params Attribute[] newAttributes)
 {
     if (existing == null)
     {
         throw new ArgumentNullException("existing");
     }
     if (newAttributes == null)
     {
         newAttributes = new Attribute[0];
     }
     Attribute[] array = new Attribute[existing.Count + newAttributes.Length];
     int count = existing.Count;
     existing.CopyTo(array, 0);
     for (int i = 0; i < newAttributes.Length; i++)
     {
         if (newAttributes[i] == null)
         {
             throw new ArgumentNullException("newAttributes");
         }
         bool flag = false;
         for (int j = 0; j < existing.Count; j++)
         {
             if (array[j].TypeId.Equals(newAttributes[i].TypeId))
             {
                 flag = true;
                 array[j] = newAttributes[i];
                 break;
             }
         }
         if (!flag)
         {
             array[count++] = newAttributes[i];
         }
     }
     Attribute[] destinationArray = null;
     if (count < array.Length)
     {
         destinationArray = new Attribute[count];
         Array.Copy(array, 0, destinationArray, 0, count);
     }
     else
     {
         destinationArray = array;
     }
     return new AttributeCollection(destinationArray);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:46,代码来源:AttributeCollection.cs

示例13: GetAttributes

        public override AttributeCollection GetAttributes()
        {
            if (_finalAttributeCollection == null)
            {
                lock (_lockAttributeGetter)
                {
                    if (_finalAttributeCollection == null)
                    {
                        bool metadataModified;
                        Type reflectedType = TypeDescriptor.GetReflectionType(_configuration.ComponentType);
                        Attribute[] originalAttributes =
                            reflectedType.GetCustomAttributes(true).Cast<Attribute>().ToArray();
                        Attribute[] finalAttributes = GetAttributes(originalAttributes, _configuration,
                                                                    out metadataModified);

                        _finalAttributeCollection = new AttributeCollection(finalAttributes);
                    }
                }
            }
            return _finalAttributeCollection;
        }
开发者ID:nenadvicentic,项目名称:CustomTypeDescriptors,代码行数:21,代码来源:LambdaTypeDescriptor.cs

示例14: DomainOperationParameter

        /// <summary>
        /// Initializes a new instance of the DomainOperationParameter class
        /// </summary>
        /// <param name="name">The name of the parameter</param>
        /// <param name="parameterType">The Type of the parameter</param>
        /// <param name="attributes">The set of attributes for the parameter</param>
        public DomainOperationParameter(string name, Type parameterType, AttributeCollection attributes)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (parameterType == null)
            {
                throw new ArgumentNullException("parameterType");
            }

            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            this._name = name;
            this._parameterType = parameterType;
            this._attributes = attributes;
        }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:27,代码来源:DomainOperationParameter.cs

示例15: SYNamePropertyDescriptor

 public SYNamePropertyDescriptor(PropertyDescriptor descr):base(descr)
 {
     _d = descr;
     int count = _d.Attributes.Count;
     Attribute[] attrs = new Attribute[count];
     Attribute vis_att = new System.ComponentModel.BrowsableAttribute(true);
     for (int i = 0; i < count; ++i)
     {
         if (_d.Attributes[i].TypeId == vis_att.TypeId)
         {
             attrs[i] = vis_att;
         }
         else
         {
             attrs[i] = _d.Attributes[i];
         }
     }
     _ac = new AttributeCollection(attrs);
     //Array.Resize(attrs, attrs.Length + 1);
     //attrs[attrs.Length - 1] = new System.ComponentModel.BrowsableAttribute(true);
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:21,代码来源:SampleTypeDescriptorFilterService.cs


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