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
- ThrowOnMultipleAssignment.cs
- StyleBamlTreeBuilder.cs
- Vector3dCollection.cs
- XmlChildEnumerator.cs
- TakeQueryOptionExpression.cs
- webeventbuffer.cs
- RegexMatchCollection.cs
- ValueSerializer.cs
- SID.cs
- GeometryHitTestResult.cs
- ManagementObjectCollection.cs
- InstanceDataCollection.cs
- DataGridCommandEventArgs.cs
- TextEditorTables.cs
- CurrencyWrapper.cs
- OutOfProcStateClientManager.cs
- HttpException.cs
- HttpListenerException.cs
- WhitespaceSignificantCollectionAttribute.cs
- altserialization.cs
- XXXInfos.cs
- TableAdapterManagerMethodGenerator.cs
- SchemaHelper.cs
- HttpHandlerAction.cs
- SettingsSection.cs
- CounterCreationDataCollection.cs
- ScriptResourceInfo.cs
- SortQueryOperator.cs
- DateTimeConverter.cs
- PaginationProgressEventArgs.cs
- MediaPlayerState.cs
- RotateTransform.cs
- SchemaCollectionPreprocessor.cs
- WebPartEditVerb.cs
- ComponentSerializationService.cs
- DecimalAnimation.cs
- Point3DValueSerializer.cs
- ToolStripArrowRenderEventArgs.cs
- ZipPackage.cs
- LinkUtilities.cs
- RelatedEnd.cs
- MenuItemAutomationPeer.cs
- RoamingStoreFileUtility.cs
- QueryCacheKey.cs
- RotateTransform.cs
- RemoteCryptoDecryptRequest.cs
- ClientBuildManagerCallback.cs
- HttpValueCollection.cs
- PackUriHelper.cs
- HandlerBase.cs
- __Error.cs
- DynamicResourceExtension.cs
- WindowHideOrCloseTracker.cs
- SQLInt16.cs
- XPathAxisIterator.cs
- SpeechSynthesizer.cs
- ListItemParagraph.cs
- TcpAppDomainProtocolHandler.cs
- Page.cs
- RelatedPropertyManager.cs
- ItemAutomationPeer.cs
- Vars.cs
- SAPICategories.cs
- OLEDB_Enum.cs
- LocalizationComments.cs
- HTMLTextWriter.cs
- CatalogPart.cs
- LayoutTable.cs
- RecognitionResult.cs
- RootDesignerSerializerAttribute.cs
- Border.cs
- CatalogPartChrome.cs
- SqlRowUpdatedEvent.cs
- AsyncResult.cs
- SqlNotificationRequest.cs
- DefaultParameterValueAttribute.cs
- SQLDoubleStorage.cs
- WebReferencesBuildProvider.cs
- ToolStripContainerDesigner.cs
- EntityDataSourceWizardForm.cs
- XmlUnspecifiedAttribute.cs
- SecurityMode.cs
- PropertyGrid.cs
- XMLSyntaxException.cs
- MenuCommandsChangedEventArgs.cs
- AssemblyBuilder.cs
- EdmFunctionAttribute.cs
- TableRowCollection.cs
- RuntimeCompatibilityAttribute.cs
- TreeViewDesigner.cs
- SocketAddress.cs
- SemanticResolver.cs
- ResourceExpressionBuilder.cs
- ClientSettingsStore.cs
- HttpCacheVaryByContentEncodings.cs
- SqlRowUpdatingEvent.cs
- SystemUdpStatistics.cs
- ParameterInfo.cs
- TdsRecordBufferSetter.cs
- XmlnsPrefixAttribute.cs