DocumentCollection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / Design / DocumentCollection.cs / 1305376 / DocumentCollection.cs

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

/* 
 */ 
namespace System.ComponentModel.Design {
    using Microsoft.Win32; 
    using System.Collections;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Runtime.InteropServices; 
    using System.Security.Permissions;
 
    ///  
    ///    
    ///       Provides a read-only collection of documents. 
    ///    
    /// 
    [HostProtection(SharedState = true)]
    [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name = "FullTrust")] 
    [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
    public class DesignerCollection : ICollection { 
        private IList designers; 

        ///  
        ///    
        ///       Initializes a new instance of the  class
        ///       that stores an array with a pointer to each 
        ///       for each document in the collection. 
        ///    
        ///  
        public DesignerCollection(IDesignerHost[] designers) { 
            if (designers != null) {
                this.designers = new ArrayList(designers); 
            }
            else {
                this.designers = new ArrayList();
            } 
        }
 
        ///  
        ///    
        ///       Initializes a new instance of the  class 
        ///       that stores an array with a pointer to each 
        ///       for each document in the collection.
        ///    
        ///  
        public DesignerCollection(IList designers) {
            this.designers = designers; 
        } 

        ///  
        ///    Gets or
        ///       sets the number
        ///       of documents in the collection.
        ///  
        public int Count {
            get { 
                return designers.Count; 
            }
        } 

        /// 
        ///     Gets
        ///       or sets the document at the specified index. 
        /// 
        public virtual IDesignerHost this[int index] { 
            get { 
                return (IDesignerHost)designers[index];
            } 
        }

        /// 
        ///    Creates and retrieves a new enumerator for this collection. 
        /// 
        public IEnumerator GetEnumerator() { 
            return designers.GetEnumerator(); 
        }
 
        /// 
        int ICollection.Count {
            get {
                return Count; 
            }
        } 
 
        /// 
        bool ICollection.IsSynchronized { 
            get {
                return false;
            }
        } 

        ///  
        object ICollection.SyncRoot { 
            get {
                return null; 
            }
        }

        ///  
        void ICollection.CopyTo(Array array, int index) {
            designers.CopyTo(array, index); 
        } 

        ///  
        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }
    } 
}
 

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

/* 
 */ 
namespace System.ComponentModel.Design {
    using Microsoft.Win32; 
    using System.Collections;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Runtime.InteropServices; 
    using System.Security.Permissions;
 
    ///  
    ///    
    ///       Provides a read-only collection of documents. 
    ///    
    /// 
    [HostProtection(SharedState = true)]
    [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name = "FullTrust")] 
    [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]
    public class DesignerCollection : ICollection { 
        private IList designers; 

        ///  
        ///    
        ///       Initializes a new instance of the  class
        ///       that stores an array with a pointer to each 
        ///       for each document in the collection. 
        ///    
        ///  
        public DesignerCollection(IDesignerHost[] designers) { 
            if (designers != null) {
                this.designers = new ArrayList(designers); 
            }
            else {
                this.designers = new ArrayList();
            } 
        }
 
        ///  
        ///    
        ///       Initializes a new instance of the  class 
        ///       that stores an array with a pointer to each 
        ///       for each document in the collection.
        ///    
        ///  
        public DesignerCollection(IList designers) {
            this.designers = designers; 
        } 

        ///  
        ///    Gets or
        ///       sets the number
        ///       of documents in the collection.
        ///  
        public int Count {
            get { 
                return designers.Count; 
            }
        } 

        /// 
        ///     Gets
        ///       or sets the document at the specified index. 
        /// 
        public virtual IDesignerHost this[int index] { 
            get { 
                return (IDesignerHost)designers[index];
            } 
        }

        /// 
        ///    Creates and retrieves a new enumerator for this collection. 
        /// 
        public IEnumerator GetEnumerator() { 
            return designers.GetEnumerator(); 
        }
 
        /// 
        int ICollection.Count {
            get {
                return Count; 
            }
        } 
 
        /// 
        bool ICollection.IsSynchronized { 
            get {
                return false;
            }
        } 

        ///  
        object ICollection.SyncRoot { 
            get {
                return null; 
            }
        }

        ///  
        void ICollection.CopyTo(Array array, int index) {
            designers.CopyTo(array, index); 
        } 

        ///  
        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }
    } 
}
 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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