1 //------------------------------------------------------------------------------
2 // <copyright file="AttributeProviderAttribute.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //------------------------------------------------------------------------------
7 namespace System.ComponentModel
11 using System.Security.Permissions;
13 /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute"]/*' />
16 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
17 [AttributeUsage(AttributeTargets.Property)]
18 public class AttributeProviderAttribute : Attribute
20 private string _typeName;
21 private string _propertyName;
23 /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.AttributeProviderAttribute"]/*' />
25 /// Creates a new AttributeProviderAttribute object.
27 public AttributeProviderAttribute(string typeName)
31 throw new ArgumentNullException("typeName");
37 /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.AttributeProviderAttribute"]/*' />
39 /// Creates a new AttributeProviderAttribute object.
41 public AttributeProviderAttribute(string typeName, string propertyName) {
42 if (typeName == null) {
43 throw new ArgumentNullException("typeName");
45 if (propertyName == null) {
46 throw new ArgumentNullException("propertyName");
50 _propertyName = propertyName;
53 /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.AttributeProviderAttribute1"]/*' />
55 /// Creates a new AttributeProviderAttribute object.
57 public AttributeProviderAttribute(Type type)
61 throw new ArgumentNullException("type");
64 _typeName = type.AssemblyQualifiedName;
67 /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.TypeName"]/*' />
69 /// The TypeName property returns the assembly qualified type name
70 /// passed into the constructor.
72 public string TypeName
80 /// <include file='doc\AttributeProviderAttribute.uex' path='docs/doc[@for="AttributeProviderAttribute.TypeName"]/*' />
82 /// The TypeName property returns the property name that will be used to query attributes from.
84 public string PropertyName {