Code:
                         / 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / TableRowCollection.cs / 1305376 / TableRowCollection.cs
                        
                        
                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
//  
//----------------------------------------------------------------------------- 
namespace System.Web.UI.WebControls { 
 
    using System;
    using System.Collections; 
    using System.ComponentModel;
    using System.Drawing.Design;
    using System.Web;
    using System.Web.UI; 
    ///  
    /// Encapsulates the collection of   
    ///  
    [ 
    Editor("System.Web.UI.Design.WebControls.TableRowsCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
    ]
    public sealed class TableRowCollection : IList {
 
        ///  
        ///    A protected field of type  
        private Table owner; 
        /// 
        ///   
        internal TableRowCollection(Table owner) {
            this.owner = owner; 
        } 
 
        /// 
        ///    Gets the
        ///    count of   
        public int Count {
            get { 
                if (owner.HasControls()) { 
                    return owner.Controls.Count;
                } 
                return 0;
            }
        }
 
        ///  
        ///     
        ///       Gets a  
        ///  
        public TableRow this[int index] {
            get { 
                return(TableRow)owner.Controls[index];
            } 
        } 
 
        /// 
        ///    
        ///       Adds the specified  
        ///   
        public int Add(TableRow row) { 
            AddAt(-1, row);
            return owner.Controls.Count - 1; 
        }
        ///  
        ///    
        ///       Adds the specified  
        ///   
        public void AddAt(int index, TableRow row) {
            owner.Controls.AddAt(index, row);
            if (row.TableSection != TableRowSection.TableBody) {
                owner.HasRowSections = true; 
            }
        } 
 
        ///  
        ///  
        public void AddRange(TableRow[] rows) {
            if (rows == null) {
                throw new ArgumentNullException("rows"); 
            }
            foreach(TableRow row in rows) { 
                Add(row); 
            }
        } 
        /// 
        /// Removes all   
        ///  
        public void Clear() { 
            if (owner.HasControls()) { 
                owner.Controls.Clear();
                owner.HasRowSections = false; 
            }
        }
 
        /// 
        ///     Returns an ordinal index value that denotes the position of the specified 
        ///      
        ///  
        public int GetRowIndex(TableRow row) { 
            if (owner.HasControls()) {
                return owner.Controls.IndexOf(row);
            }
            return -1; 
        }
 
 
        /// 
        ///     
        ///       Returns an enumerator of all  
        ///   
        public IEnumerator GetEnumerator() {
            return owner.Controls.GetEnumerator(); 
        } 
 
        /// 
        /// Copies contents from the collection to the specified  
        ///   
        public void CopyTo(Array array, int index) {
            for (IEnumerator e = this.GetEnumerator(); e.MoveNext();) 
                array.SetValue(e.Current, index++); 
        }
 
        /// 
        ///    
        ///       Gets the object that can be used to synchronize access to the collection. In 
        ///       this case, it is the collection itself.
        ///      
        ///   
        public Object SyncRoot {
            get { return this;} 
        }
        ///  
        ///    
        ///       Gets a value indicating whether the collection is read-only. 
        ///      
        ///  
        public bool IsReadOnly { 
            get { return false;}
        }
 
        /// 
        ///     
        ///       Gets a value indicating whether access to the collection is synchronized 
        ///       (thread-safe).
        ///      
        ///  
        public bool IsSynchronized {
            get { return false;}
        } 
 
        ///  
        /// Removes the specified  
        ///   
        public void Remove(TableRow row) {
            owner.Controls.Remove(row);
        }
 
        ///  
        /// Removes the  
        ///   
        public void RemoveAt(int index) {
            owner.Controls.RemoveAt(index);
        }
 
        // IList implementation, required by collection editor
 
        /// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
//  
//----------------------------------------------------------------------------- 
namespace System.Web.UI.WebControls { 
 
    using System;
    using System.Collections; 
    using System.ComponentModel;
    using System.Drawing.Design;
    using System.Web;
    using System.Web.UI; 
    ///  
    /// Encapsulates the collection of   
    ///  
    [ 
    Editor("System.Web.UI.Design.WebControls.TableRowsCollectionEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor))
    ]
    public sealed class TableRowCollection : IList {
 
        ///  
        ///    A protected field of type  
        private Table owner; 
        /// 
        ///   
        internal TableRowCollection(Table owner) {
            this.owner = owner; 
        } 
 
        /// 
        ///    Gets the
        ///    count of   
        public int Count {
            get { 
                if (owner.HasControls()) { 
                    return owner.Controls.Count;
                } 
                return 0;
            }
        }
 
        ///  
        ///     
        ///       Gets a  
        ///  
        public TableRow this[int index] {
            get { 
                return(TableRow)owner.Controls[index];
            } 
        } 
 
        /// 
        ///    
        ///       Adds the specified  
        ///   
        public int Add(TableRow row) { 
            AddAt(-1, row);
            return owner.Controls.Count - 1; 
        }
        ///  
        ///    
        ///       Adds the specified  
        ///   
        public void AddAt(int index, TableRow row) {
            owner.Controls.AddAt(index, row);
            if (row.TableSection != TableRowSection.TableBody) {
                owner.HasRowSections = true; 
            }
        } 
 
        ///  
        ///  
        public void AddRange(TableRow[] rows) {
            if (rows == null) {
                throw new ArgumentNullException("rows"); 
            }
            foreach(TableRow row in rows) { 
                Add(row); 
            }
        } 
        /// 
        /// Removes all   
        ///  
        public void Clear() { 
            if (owner.HasControls()) { 
                owner.Controls.Clear();
                owner.HasRowSections = false; 
            }
        }
 
        /// 
        ///     Returns an ordinal index value that denotes the position of the specified 
        ///      
        ///  
        public int GetRowIndex(TableRow row) { 
            if (owner.HasControls()) {
                return owner.Controls.IndexOf(row);
            }
            return -1; 
        }
 
 
        /// 
        ///     
        ///       Returns an enumerator of all  
        ///   
        public IEnumerator GetEnumerator() {
            return owner.Controls.GetEnumerator(); 
        } 
 
        /// 
        /// Copies contents from the collection to the specified  
        ///   
        public void CopyTo(Array array, int index) {
            for (IEnumerator e = this.GetEnumerator(); e.MoveNext();) 
                array.SetValue(e.Current, index++); 
        }
 
        /// 
        ///    
        ///       Gets the object that can be used to synchronize access to the collection. In 
        ///       this case, it is the collection itself.
        ///      
        ///   
        public Object SyncRoot {
            get { return this;} 
        }
        ///  
        ///    
        ///       Gets a value indicating whether the collection is read-only. 
        ///      
        ///  
        public bool IsReadOnly { 
            get { return false;}
        }
 
        /// 
        ///     
        ///       Gets a value indicating whether access to the collection is synchronized 
        ///       (thread-safe).
        ///      
        ///  
        public bool IsSynchronized {
            get { return false;}
        } 
 
        ///  
        /// Removes the specified  
        ///   
        public void Remove(TableRow row) {
            owner.Controls.Remove(row);
        }
 
        ///  
        /// Removes the  
        ///   
        public void RemoveAt(int index) {
            owner.Controls.RemoveAt(index);
        }
 
        // IList implementation, required by collection editor
 
        /// 
                        
                        
                        
                    Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AutomationElement.cs
- NavigationFailedEventArgs.cs
- XamlToRtfWriter.cs
- WpfWebRequestHelper.cs
- SafeRightsManagementHandle.cs
- SrgsSubset.cs
- XmlHelper.cs
- SqlGenerator.cs
- TextTreeFixupNode.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- Policy.cs
- GenericEnumConverter.cs
- PopupEventArgs.cs
- NativeMethods.cs
- MimeWriter.cs
- BaseDataListDesigner.cs
- KnowledgeBase.cs
- SecurityContextTokenValidationException.cs
- TrustManagerPromptUI.cs
- LongValidatorAttribute.cs
- CounterSetInstance.cs
- DeferredElementTreeState.cs
- RenderingBiasValidation.cs
- CheckBoxList.cs
- WpfXamlMember.cs
- TableLayoutPanel.cs
- MembershipSection.cs
- DataGridAutomationPeer.cs
- Track.cs
- GroupQuery.cs
- ImageSource.cs
- Socket.cs
- StringPropertyBuilder.cs
- ConnectionManagementElementCollection.cs
- ContextMenu.cs
- SyndicationSerializer.cs
- EdgeModeValidation.cs
- ConfigurationValidatorAttribute.cs
- HttpModuleCollection.cs
- ListMarkerSourceInfo.cs
- BaseHashHelper.cs
- EnumMember.cs
- RegionIterator.cs
- DelegateInArgument.cs
- ComboBoxAutomationPeer.cs
- LeftCellWrapper.cs
- MSAAEventDispatcher.cs
- HtmlTableRow.cs
- RoleService.cs
- BrushProxy.cs
- SynchronizationHandlesCodeDomSerializer.cs
- dataprotectionpermissionattribute.cs
- SmtpReplyReaderFactory.cs
- XmlJsonWriter.cs
- ADRole.cs
- ListItemCollection.cs
- WebPartDisplayModeCancelEventArgs.cs
- Renderer.cs
- ItemCheckedEvent.cs
- MenuBase.cs
- HttpCookie.cs
- CompiledIdentityConstraint.cs
- RIPEMD160Managed.cs
- EntityTypeEmitter.cs
- StreamReader.cs
- ToolStripItemCollection.cs
- XmlSchemaAnnotation.cs
- QuaternionConverter.cs
- WindowsTooltip.cs
- DLinqAssociationProvider.cs
- QilInvokeLateBound.cs
- MessageQueuePermission.cs
- ScopeCompiler.cs
- NativeMethods.cs
- DictionarySectionHandler.cs
- ToolStripItemRenderEventArgs.cs
- ToolTip.cs
- Pen.cs
- AutomationPropertyInfo.cs
- RankException.cs
- WebControlParameterProxy.cs
- BufferedGraphicsManager.cs
- BamlTreeUpdater.cs
- PartialCachingAttribute.cs
- ScrollChrome.cs
- EventLogPermissionEntry.cs
- ZipIOLocalFileHeader.cs
- PageParserFilter.cs
- EmptyEnumerator.cs
- PagedDataSource.cs
- Error.cs
- ScriptingScriptResourceHandlerSection.cs
- XPathNavigatorReader.cs
- PropertyCollection.cs
- DocumentViewer.cs
- XmlSerializerFactory.cs
- ReflectionUtil.cs
- IntSecurity.cs
- ScriptHandlerFactory.cs
- PartialCachingControl.cs