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
- StorageRoot.cs
- SqlReferenceCollection.cs
- RSAOAEPKeyExchangeDeformatter.cs
- BufferBuilder.cs
- AVElementHelper.cs
- ReachIDocumentPaginatorSerializer.cs
- BeginStoryboard.cs
- LazyTextWriterCreator.cs
- TypeInitializationException.cs
- ActivityExecutorDelegateInfo.cs
- XPathDocumentNavigator.cs
- TextOutput.cs
- WebEvents.cs
- SystemColorTracker.cs
- DataSysAttribute.cs
- Composition.cs
- HTMLTextWriter.cs
- XmlnsDictionary.cs
- Vector3D.cs
- BindStream.cs
- Image.cs
- TableParagraph.cs
- CompiledAction.cs
- MailWebEventProvider.cs
- ScriptControl.cs
- BitmapEffectInputConnector.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- SchemaImporterExtension.cs
- XPathNodeHelper.cs
- XmlSequenceWriter.cs
- DataGridViewDataConnection.cs
- BlockCollection.cs
- FormsAuthenticationModule.cs
- GrammarBuilderWildcard.cs
- SmiXetterAccessMap.cs
- EmulateRecognizeCompletedEventArgs.cs
- Claim.cs
- EnumMember.cs
- entityreference_tresulttype.cs
- regiisutil.cs
- IsolationInterop.cs
- ExtensionQuery.cs
- ContractUtils.cs
- SamlEvidence.cs
- OperatingSystem.cs
- AdPostCacheSubstitution.cs
- TransactionContext.cs
- StylusPlugin.cs
- Timer.cs
- FunctionNode.cs
- ThicknessAnimation.cs
- DataView.cs
- TextElementCollectionHelper.cs
- webeventbuffer.cs
- StorageConditionPropertyMapping.cs
- StreamInfo.cs
- CodeExporter.cs
- SqlConnectionHelper.cs
- GraphicsContainer.cs
- DataBoundControlParameterTarget.cs
- TypeProvider.cs
- DiagnosticsConfiguration.cs
- Events.cs
- NetSectionGroup.cs
- CompilerScope.cs
- XmlBinaryReader.cs
- ScrollContentPresenter.cs
- CompilerState.cs
- QuaternionValueSerializer.cs
- QueryResults.cs
- HtmlInputFile.cs
- MarkupCompilePass2.cs
- XpsThumbnail.cs
- SafeEventLogWriteHandle.cs
- StatusStrip.cs
- XmlBoundElement.cs
- DbProviderFactory.cs
- AtomServiceDocumentSerializer.cs
- ScriptResourceInfo.cs
- StrokeIntersection.cs
- PriorityQueue.cs
- unsafeIndexingFilterStream.cs
- _Semaphore.cs
- ServiceMetadataPublishingElement.cs
- BStrWrapper.cs
- figurelength.cs
- DocumentApplicationJournalEntry.cs
- SystemDropShadowChrome.cs
- ObjectTag.cs
- ObjectSecurity.cs
- SqlBuffer.cs
- BitmapMetadataEnumerator.cs
- RouteCollection.cs
- PassportAuthenticationEventArgs.cs
- Canvas.cs
- WindowsSpinner.cs
- SoundPlayer.cs
- WebReferenceCollection.cs
- WebResourceUtil.cs
- WindowsContainer.cs