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
- EventlogProvider.cs
- NameSpaceExtractor.cs
- DecimalKeyFrameCollection.cs
- DataGridViewCellMouseEventArgs.cs
- WsdlBuildProvider.cs
- LOSFormatter.cs
- DictionaryGlobals.cs
- BuildResult.cs
- StylusButton.cs
- ObjectDisposedException.cs
- AutomationElementIdentifiers.cs
- Animatable.cs
- DataMemberListEditor.cs
- RectKeyFrameCollection.cs
- ToolStripDropDownMenu.cs
- AuthenticationModuleElement.cs
- ContextMenuStripActionList.cs
- LicFileLicenseProvider.cs
- DataQuery.cs
- ScalarType.cs
- SmiGettersStream.cs
- TransformConverter.cs
- SortedDictionary.cs
- Container.cs
- FolderBrowserDialog.cs
- ContravarianceAdapter.cs
- StreamUpgradeAcceptor.cs
- Localizer.cs
- XmlDataLoader.cs
- CodeDomDecompiler.cs
- AuthorizationRuleCollection.cs
- SeekableReadStream.cs
- SamlAttributeStatement.cs
- StylusPointPropertyId.cs
- TrackingMemoryStreamFactory.cs
- SiteMap.cs
- FormatConvertedBitmap.cs
- GeneralTransform3DGroup.cs
- DataGridAutomationPeer.cs
- CustomLineCap.cs
- XmlImplementation.cs
- DesignerValidatorAdapter.cs
- GlobalizationAssembly.cs
- FixedSOMFixedBlock.cs
- PerfCounterSection.cs
- OdbcConnectionString.cs
- CacheMode.cs
- XamlToRtfWriter.cs
- XmlWrappingWriter.cs
- CaseInsensitiveHashCodeProvider.cs
- AppSecurityManager.cs
- TableRow.cs
- ClientSession.cs
- _TimerThread.cs
- HtmlToClrEventProxy.cs
- RawStylusInputReport.cs
- OdbcEnvironmentHandle.cs
- DesignerVerbCollection.cs
- Underline.cs
- DynamicResourceExtensionConverter.cs
- XmlTextReader.cs
- StateMachineWorkflow.cs
- DataObjectEventArgs.cs
- ScrollBar.cs
- assertwrapper.cs
- BamlTreeUpdater.cs
- PackWebRequest.cs
- ReferencedAssembly.cs
- SqlTriggerAttribute.cs
- Visitors.cs
- CharEnumerator.cs
- ActivationArguments.cs
- DataListItemEventArgs.cs
- SiteMapNodeItemEventArgs.cs
- MbpInfo.cs
- FixedPageProcessor.cs
- DataGridColumnCollectionEditor.cs
- DbConnectionOptions.cs
- Vector3DCollectionValueSerializer.cs
- DataGridViewSelectedRowCollection.cs
- SortDescription.cs
- ContentPropertyAttribute.cs
- Substitution.cs
- PrinterResolution.cs
- XmlNamespaceDeclarationsAttribute.cs
- SynchronizationLockException.cs
- SiteMapDataSourceView.cs
- TrackingRecordPreFilter.cs
- Cursor.cs
- XPathNodeList.cs
- Expander.cs
- Int32Storage.cs
- ColorAnimationUsingKeyFrames.cs
- VectorKeyFrameCollection.cs
- VsPropertyGrid.cs
- SapiRecognizer.cs
- ActivityExecutor.cs
- DbProviderFactory.cs
- RotateTransform3D.cs
- UpdatePanelControlTrigger.cs