AttributeProviderAttribute.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / AttributeProviderAttribute.cs / 1 / AttributeProviderAttribute.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.ComponentModel 
{ 

    using System; 
    using System.Security.Permissions;

    /// 
    ///  
    /// 
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")] 
    [AttributeUsage(AttributeTargets.Property)] 
    public class AttributeProviderAttribute : Attribute
    { 
        private string _typeName;
        private string _propertyName;

        ///  
        /// 
        ///     Creates a new AttributeProviderAttribute object. 
        ///  
        public AttributeProviderAttribute(string typeName)
        { 
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            } 

            _typeName = typeName; 
        } 

        ///  
        /// 
        ///     Creates a new AttributeProviderAttribute object.
        /// 
        public AttributeProviderAttribute(string typeName, string propertyName) { 
            if (typeName == null) {
                throw new ArgumentNullException("typeName"); 
            } 
            if (propertyName == null) {
                throw new ArgumentNullException("propertyName"); 
            }

            _typeName = typeName;
 			_propertyName = propertyName; 
        }
 
        ///  
        /// 
        ///     Creates a new AttributeProviderAttribute object. 
        /// 
        public AttributeProviderAttribute(Type type)
        {
            if (type == null) 
            {
                throw new ArgumentNullException("type"); 
            } 

            _typeName = type.AssemblyQualifiedName; 
        }

        /// 
        ///  
        ///     The TypeName property returns the assembly qualified type name
        ///     passed into the constructor. 
        ///  
        public string TypeName
        { 
            get
            {
                return _typeName;
            } 
        }
 
        ///  
        /// 
        ///     The TypeName property returns the property name that will be used to query attributes from. 
        /// 
        public string PropertyName {
            get {
                return _propertyName; 
            }
        } 
    } 
}
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK