Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / FormCollection.cs / 1 / 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
- WSMessageEncoding.cs
- Configuration.cs
- TraceContext.cs
- RemotingConfiguration.cs
- CrossContextChannel.cs
- X509Utils.cs
- ComponentEditorPage.cs
- ClockController.cs
- SystemIPv6InterfaceProperties.cs
- Viewport2DVisual3D.cs
- AttachedAnnotation.cs
- CssStyleCollection.cs
- PagerStyle.cs
- XPathNavigator.cs
- Interlocked.cs
- Rectangle.cs
- SQLMoneyStorage.cs
- DocumentViewerAutomationPeer.cs
- DataRelation.cs
- CodeBinaryOperatorExpression.cs
- AccessorTable.cs
- XPathDocumentNavigator.cs
- HttpWebRequestElement.cs
- ToolBarPanel.cs
- ErrorHandler.cs
- CLRBindingWorker.cs
- KeyGesture.cs
- CodeRemoveEventStatement.cs
- NativeActivityMetadata.cs
- LinqToSqlWrapper.cs
- Base64Decoder.cs
- RowVisual.cs
- TimeSpan.cs
- TreeViewImageKeyConverter.cs
- ReadOnlyPermissionSet.cs
- DES.cs
- ThreadAttributes.cs
- GroupByQueryOperator.cs
- WizardForm.cs
- CodeConstructor.cs
- Property.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- SourceFilter.cs
- TypeDescriptor.cs
- ManipulationPivot.cs
- DataContractAttribute.cs
- Boolean.cs
- KeyGesture.cs
- HasCopySemanticsAttribute.cs
- PeerCollaboration.cs
- SecurityImpersonationBehavior.cs
- SeparatorAutomationPeer.cs
- ClientRuntimeConfig.cs
- XmlRootAttribute.cs
- ModuleElement.cs
- InternalTransaction.cs
- PerformanceCounterPermissionAttribute.cs
- MulticastIPAddressInformationCollection.cs
- StyleTypedPropertyAttribute.cs
- DataRecordInternal.cs
- ProtectedConfiguration.cs
- ProvideValueServiceProvider.cs
- sitestring.cs
- IgnorePropertiesAttribute.cs
- HtmlLink.cs
- RepeaterItemEventArgs.cs
- FrameworkElementFactory.cs
- MenuItemAutomationPeer.cs
- ArraySubsetEnumerator.cs
- ListControl.cs
- EntityViewGenerationAttribute.cs
- Permission.cs
- DesignerAttribute.cs
- TextPattern.cs
- SchemaImporterExtension.cs
- TaskForm.cs
- DataRelationPropertyDescriptor.cs
- DataBoundLiteralControl.cs
- XmlElementElementCollection.cs
- Hashtable.cs
- safelinkcollection.cs
- login.cs
- DbConnectionPoolCounters.cs
- ShaderEffect.cs
- XmlReturnWriter.cs
- ManualResetEvent.cs
- Rect3DConverter.cs
- ProxyHwnd.cs
- EnumValidator.cs
- SerializationAttributes.cs
- NativeMethods.cs
- dataSvcMapFileLoader.cs
- CodeTypeDeclarationCollection.cs
- CodeDelegateCreateExpression.cs
- NGCPageContentSerializerAsync.cs
- ValueSerializerAttribute.cs
- MetadataCacheItem.cs
- PrimitiveXmlSerializers.cs
- PropertyEmitterBase.cs
- Timeline.cs