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
- ReadOnlyHierarchicalDataSource.cs
- XPathSelfQuery.cs
- NegationPusher.cs
- InitializationEventAttribute.cs
- DoubleLink.cs
- ClientRequest.cs
- HideDisabledControlAdapter.cs
- TogglePatternIdentifiers.cs
- MultipartContentParser.cs
- Int32CAMarshaler.cs
- CharacterBuffer.cs
- PrefixHandle.cs
- ComponentCommands.cs
- ReverseQueryOperator.cs
- PrintPreviewDialog.cs
- SchemaRegistration.cs
- HandlerWithFactory.cs
- ToolboxControl.cs
- CodeExporter.cs
- TreeNodeEventArgs.cs
- TextStore.cs
- ScriptBehaviorDescriptor.cs
- TileModeValidation.cs
- RuntimeEnvironment.cs
- ResXFileRef.cs
- RuleConditionDialog.cs
- OutputCacheSettingsSection.cs
- PropertyMetadata.cs
- XmlValidatingReaderImpl.cs
- TreeViewItemAutomationPeer.cs
- XmlSchemaSubstitutionGroup.cs
- Matrix.cs
- CodeTypeOfExpression.cs
- ModifyActivitiesPropertyDescriptor.cs
- XmlNamespaceManager.cs
- DocumentScope.cs
- FontWeightConverter.cs
- ContainsRowNumberChecker.cs
- SqlTransaction.cs
- Tuple.cs
- ProgressPage.cs
- ChildTable.cs
- RoutedUICommand.cs
- ImportContext.cs
- Point3DCollection.cs
- UIPropertyMetadata.cs
- PersonalizableAttribute.cs
- SynchronizedCollection.cs
- InputDevice.cs
- IProducerConsumerCollection.cs
- ResumeStoryboard.cs
- ExpressionVisitor.cs
- GraphicsPath.cs
- OleDbEnumerator.cs
- AnimatedTypeHelpers.cs
- XsdDateTime.cs
- _ScatterGatherBuffers.cs
- HttpServerVarsCollection.cs
- SoapElementAttribute.cs
- LinqDataSourceStatusEventArgs.cs
- CaseInsensitiveHashCodeProvider.cs
- BulletDecorator.cs
- RuleInfoComparer.cs
- RotateTransform.cs
- WindowsTokenRoleProvider.cs
- WhileDesigner.xaml.cs
- MemberPath.cs
- MediaPlayerState.cs
- Point3DAnimationUsingKeyFrames.cs
- HttpProfileGroupBase.cs
- designeractionlistschangedeventargs.cs
- CapabilitiesSection.cs
- SimpleHandlerFactory.cs
- SQLString.cs
- ParallelEnumerable.cs
- EmptyElement.cs
- FileDialog.cs
- UnsafeNativeMethods.cs
- ProtectedProviderSettings.cs
- DBAsyncResult.cs
- PathFigureCollection.cs
- UnsettableComboBox.cs
- GridViewDeleteEventArgs.cs
- XmlNamespaceMapping.cs
- XmlSchemaAppInfo.cs
- TextEditorSelection.cs
- Lasso.cs
- DataBoundControlAdapter.cs
- EntityDataSourceContextCreatedEventArgs.cs
- DbProviderManifest.cs
- SelectionPatternIdentifiers.cs
- ISO2022Encoding.cs
- HtmlTableRow.cs
- Utils.cs
- FunctionNode.cs
- StylusEventArgs.cs
- DataGridRelationshipRow.cs
- HtmlHead.cs
- HtmlTableRowCollection.cs
- _ShellExpression.cs