ExtenderProviderService.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 / Designer / Host / ExtenderProviderService.cs / 1 / ExtenderProviderService.cs

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

namespace System.ComponentModel.Design { 
 
    using System;
    using System.Collections; 
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Design;
    using System.Diagnostics; 

    ///  
    ///     The extender provider service actually provides two services:  IExtenderProviderService, 
    ///     which allows other objects to add and remove extender providers, and IExtenderListService,
    ///     which is used by TypeDescriptor to discover the set of extender providers. 
    /// 
    internal sealed class ExtenderProviderService : IExtenderProviderService, IExtenderListService {

        private ArrayList _providers; 

        ///  
        ///     Internal ctor to prevent semitrust from creating us. 
        /// 
        internal ExtenderProviderService() { 
        }

        /// 
        ///    Gets the set of extender providers for the component. 
        /// 
        IExtenderProvider[] IExtenderListService.GetExtenderProviders() { 
            if (_providers != null) { 
                IExtenderProvider[] providers = new IExtenderProvider[_providers.Count];
                _providers.CopyTo(providers, 0); 
                return providers;
            }

            return new IExtenderProvider[0]; 
        }
 
        ///  
        ///    
        ///       Adds an extender provider. 
        ///    
        /// 
        void IExtenderProviderService.AddExtenderProvider(IExtenderProvider provider) {
 
            if (provider == null) {
                throw new ArgumentNullException("provider"); 
            } 

            if (_providers == null) { 
                _providers = new ArrayList(4);
            }

            if (_providers.Contains(provider)) { 
                throw new ArgumentException(SR.GetString(SR.ExtenderProviderServiceDuplicateProvider, provider));
            } 
 
            _providers.Add(provider);
        } 

        /// 
        ///    
        ///       Removes 
        ///       an extender provider.
        ///     
        ///  
        void IExtenderProviderService.RemoveExtenderProvider(IExtenderProvider provider) {
 
            if (provider == null) {
                throw new ArgumentNullException("provider");
            }
 
            if (_providers != null) {
                _providers.Remove(provider); 
            } 
        }
    } 
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

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