ComponentCollection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / ComponentCollection.cs / 1 / ComponentCollection.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//  
//     This class was generated by a tool.
//     Runtime Version: 1.0.2204.0 
// 
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated. 
// 
//-----------------------------------------------------------------------------

 
using System.Diagnostics.CodeAnalysis;
 
/* 
 This class has the HostProtectionAttribute. The purpose of this attribute is to enforce host-specific programming model guidelines, not security behavior.
 Suppress FxCop message - BUT REVISIT IF ADDING NEW SECURITY ATTRIBUTES. 
*/
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.ComponentModel.ComponentCollection..ctor(System.ComponentModel.IComponent[])")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope="member", Target="System.ComponentModel.ComponentCollection.get_Item(System.String):System.ComponentModel.IComponent")]
 

namespace System.ComponentModel { 
    using System; 
    using System.Collections;
    using System.ComponentModel; 
    using System.Globalization;
    using System.Security.Permissions;

    /** The component in the container identified by name. */ 
    /// 
    ///     
    ///       Gets a specific  in the  
    ///       .
    ///     
    /// 
    [System.Runtime.InteropServices.ComVisible(true)]
    [HostProtection(Synchronization=true)]
    public class ComponentCollection : ReadOnlyCollectionBase { 
        /// 
        ///    [To be supplied.] 
        ///  
        public ComponentCollection(IComponent[] components) {
            InnerList.AddRange(components); 
        }

        /** The component in the container identified by name. */
        ///  
        ///    
        ///       Gets a specific  in the  
        ///       . 
        ///    
        ///  
        public virtual IComponent this[string name] {
            get {
                if (name != null) {
                    IList list = InnerList; 
                    foreach(IComponent comp in list) {
                        if (comp != null && comp.Site != null && comp.Site.Name != null && string.Equals(comp.Site.Name, name, StringComparison.OrdinalIgnoreCase)) { 
                            return comp; 
                        }
                    } 
                }
                return null;
            }
        } 

        /** The component in the container identified by index. */ 
        ///  
        ///    
        ///       Gets a specific  in the  
        ///       .
        ///    
        /// 
        public virtual IComponent this[int index] { 
            get {
                return (IComponent)InnerList[index]; 
            } 
        }
 
        /// 
        ///    [To be supplied.]
        /// 
        public void CopyTo(IComponent[] array, int index) { 
            InnerList.CopyTo(array, index);
        } 
    } 
}
                        

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