Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / FormCollection.cs / 1305376 / FormCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Collections; using System.ComponentModel; using System.Globalization; ////// /// public class FormCollection : ReadOnlyCollectionBase { internal static object CollectionSyncRoot = new object(); ////// This is a read only collection of Forms exposed as a static property of the /// Application class. This is used to store all the currently loaded forms in an app. /// ////// /// public virtual Form this[string name] { get { if (name != null) { lock (CollectionSyncRoot) { foreach(Form form in InnerList) { if (string.Equals(form.Name, name, StringComparison.OrdinalIgnoreCase)) { return form; } } } } return null; } } ////// Gets a form specified by name, if present, else returns null. If there are multiple /// forms with matching names, the first form found is returned. /// ////// /// public virtual Form this[int index] { get { Form f = null; lock (CollectionSyncRoot) { f = (Form) InnerList[index]; } return f; } } ////// Gets a form specified by index. /// ////// Used internally to add a Form to the FormCollection /// internal void Add(Form form) { lock (CollectionSyncRoot) { InnerList.Add(form); } } ////// Used internally to check if a Form is in the FormCollection /// internal bool Contains(Form form) { bool inCollection = false; lock (CollectionSyncRoot) { inCollection = InnerList.Contains(form); } return inCollection; } ////// Used internally to add a Form to the FormCollection /// internal void Remove(Form form) { lock (CollectionSyncRoot) { InnerList.Remove(form); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UnsafeNativeMethods.cs
- SqlInternalConnectionTds.cs
- ExclusiveHandle.cs
- LazyTextWriterCreator.cs
- XmlSchemaFacet.cs
- EncryptedData.cs
- HijriCalendar.cs
- UIAgentCrashedException.cs
- ProxyWebPart.cs
- Application.cs
- XPathScanner.cs
- WebMessageEncoderFactory.cs
- LiteralTextContainerControlBuilder.cs
- ListViewCommandEventArgs.cs
- SpeechEvent.cs
- ToolZone.cs
- WebBaseEventKeyComparer.cs
- ParentControlDesigner.cs
- FontEmbeddingManager.cs
- SmiMetaData.cs
- ReadOnlyHierarchicalDataSource.cs
- URL.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- Exceptions.cs
- ReadOnlyDataSource.cs
- ObjectDataSourceSelectingEventArgs.cs
- Pkcs9Attribute.cs
- BindingCollection.cs
- Schedule.cs
- FormsAuthenticationUserCollection.cs
- ActiveDocumentEvent.cs
- RepeatButtonAutomationPeer.cs
- SystemUdpStatistics.cs
- SliderAutomationPeer.cs
- URIFormatException.cs
- ImageKeyConverter.cs
- DataObjectEventArgs.cs
- Focus.cs
- HMACSHA1.cs
- StylusEventArgs.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- Roles.cs
- BufferModeSettings.cs
- TopClause.cs
- AssociationSet.cs
- PopupRoot.cs
- DesignerDataTable.cs
- Polygon.cs
- LogPolicy.cs
- VectorAnimationUsingKeyFrames.cs
- CheckBoxStandardAdapter.cs
- DynamicPropertyHolder.cs
- DropSource.cs
- PreservationFileWriter.cs
- SByteStorage.cs
- DataException.cs
- AnnotationHighlightLayer.cs
- Ref.cs
- BezierSegment.cs
- AssemblyInfo.cs
- PersonalizationAdministration.cs
- DataColumnMapping.cs
- XmlDataImplementation.cs
- HtmlEncodedRawTextWriter.cs
- CodeDOMUtility.cs
- _LocalDataStoreMgr.cs
- ModuleBuilderData.cs
- SemanticBasicElement.cs
- MultiTrigger.cs
- AddInAdapter.cs
- OwnerDrawPropertyBag.cs
- FigureParagraph.cs
- RC2CryptoServiceProvider.cs
- RepeaterItemCollection.cs
- BuildProvidersCompiler.cs
- WebPartDescription.cs
- ValueTypeFixupInfo.cs
- ContainerActivationHelper.cs
- ColumnWidthChangedEvent.cs
- VariableBinder.cs
- invalidudtexception.cs
- AuthenticationService.cs
- ErrorWebPart.cs
- PermissionListSet.cs
- NotCondition.cs
- WebBrowserSiteBase.cs
- PerspectiveCamera.cs
- AspNetRouteServiceHttpHandler.cs
- BaseContextMenu.cs
- CommonXSendMessage.cs
- ListViewDataItem.cs
- FixedPosition.cs
- ComponentGlyph.cs
- DataRowChangeEvent.cs
- ISAPIRuntime.cs
- XmlnsCache.cs
- SoapReflectionImporter.cs
- ArcSegment.cs
- HandlerBase.cs
- EventProviderTraceListener.cs