Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- TextModifier.cs
- LazyTextWriterCreator.cs
- HttpResponse.cs
- PropertyDescriptors.cs
- TransformerInfoCollection.cs
- TypedElement.cs
- GridItemProviderWrapper.cs
- Light.cs
- TextAdaptor.cs
- ExclusiveCanonicalizationTransform.cs
- GroupByExpressionRewriter.cs
- EmbeddedObject.cs
- BindingCollection.cs
- EntitySetBaseCollection.cs
- RuntimeArgumentHandle.cs
- CapabilitiesUse.cs
- TextRangeBase.cs
- Attachment.cs
- MimePart.cs
- Visual3D.cs
- PaintValueEventArgs.cs
- GeometryDrawing.cs
- HttpClientCertificate.cs
- XmlSchemas.cs
- externdll.cs
- _ConnectStream.cs
- OleServicesContext.cs
- RectangleGeometry.cs
- SolidColorBrush.cs
- XomlCompilerParameters.cs
- UnicodeEncoding.cs
- templategroup.cs
- Positioning.cs
- SeverityFilter.cs
- ConstraintCollection.cs
- PageBuildProvider.cs
- EditingCoordinator.cs
- OdbcFactory.cs
- OdbcException.cs
- PeerToPeerException.cs
- BitmapFrameDecode.cs
- ToolStrip.cs
- EnumType.cs
- DesignerLoader.cs
- MessagePropertyVariants.cs
- ChildrenQuery.cs
- DropDownHolder.cs
- TableRow.cs
- GenericEnumerator.cs
- NativeMethods.cs
- OneOf.cs
- CalculatedColumn.cs
- DisplayMemberTemplateSelector.cs
- OuterProxyWrapper.cs
- BamlLocalizableResource.cs
- WebPartHeaderCloseVerb.cs
- ErrorHandlerFaultInfo.cs
- DateTimeUtil.cs
- PageContentAsyncResult.cs
- TypefaceMap.cs
- ClosableStream.cs
- ContextBase.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- ProviderBase.cs
- LinqExpressionNormalizer.cs
- TableLayoutRowStyleCollection.cs
- ComponentCollection.cs
- HostedTransportConfigurationManager.cs
- DecimalAnimationUsingKeyFrames.cs
- GreenMethods.cs
- DrawingGroup.cs
- DesignTimeHTMLTextWriter.cs
- XmlNode.cs
- GenericNameHandler.cs
- CodeLinePragma.cs
- ColumnHeaderConverter.cs
- IssuanceTokenProviderState.cs
- Quaternion.cs
- FixedLineResult.cs
- KeyValueConfigurationElement.cs
- FrameworkTextComposition.cs
- ContainerAction.cs
- StateMachineWorkflowDesigner.cs
- TemplateBindingExpressionConverter.cs
- RadialGradientBrush.cs
- NotifyParentPropertyAttribute.cs
- DataGridColumnStyleMappingNameEditor.cs
- ObjectStateManagerMetadata.cs
- PerfCounters.cs
- CommentEmitter.cs
- ListViewDesigner.cs
- ThemeDirectoryCompiler.cs
- WorkflowViewManager.cs
- ProxyHwnd.cs
- CommandDevice.cs
- Stack.cs
- MaskedTextBox.cs
- RegionData.cs
- CheckBox.cs
- RegionInfo.cs