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
- ControlCodeDomSerializer.cs
- DataSetMappper.cs
- ComponentCommands.cs
- RC2CryptoServiceProvider.cs
- ContextStack.cs
- SqlDataSourceStatusEventArgs.cs
- XamlHostingSectionGroup.cs
- CompilerGlobalScopeAttribute.cs
- ContentElementAutomationPeer.cs
- BoundColumn.cs
- PerformanceCounterPermissionAttribute.cs
- DocumentPaginator.cs
- ExtractorMetadata.cs
- RegexCharClass.cs
- CompModSwitches.cs
- SQLInt64Storage.cs
- wgx_commands.cs
- MessageBodyMemberAttribute.cs
- AsyncDataRequest.cs
- AutoCompleteStringCollection.cs
- ContractCodeDomInfo.cs
- _TimerThread.cs
- RectAnimationBase.cs
- BaseWebProxyFinder.cs
- ToolBarOverflowPanel.cs
- StdValidatorsAndConverters.cs
- ViewKeyConstraint.cs
- XmlSchemaSimpleTypeRestriction.cs
- DataGridViewTopRowAccessibleObject.cs
- DecimalFormatter.cs
- TextTreeUndo.cs
- MimeTextImporter.cs
- _HeaderInfo.cs
- EntityDataSourceMemberPath.cs
- Animatable.cs
- _CookieModule.cs
- NotificationContext.cs
- SolidColorBrush.cs
- PathGradientBrush.cs
- WindowsListView.cs
- Menu.cs
- FaultConverter.cs
- HttpWebResponse.cs
- AnonymousIdentificationModule.cs
- ConstraintConverter.cs
- DataKeyArray.cs
- HtmlShim.cs
- PasswordRecovery.cs
- ADMembershipProvider.cs
- TextTreeRootNode.cs
- GeometryGroup.cs
- NamespaceMapping.cs
- InstanceDescriptor.cs
- SynchronizedInputHelper.cs
- printdlgexmarshaler.cs
- TextElementCollection.cs
- SystemDropShadowChrome.cs
- Renderer.cs
- BoolLiteral.cs
- CompilerTypeWithParams.cs
- CompilerLocalReference.cs
- CanExecuteRoutedEventArgs.cs
- SoapSchemaMember.cs
- TemplateControlBuildProvider.cs
- ContextQuery.cs
- RotateTransform3D.cs
- Size3D.cs
- RootBuilder.cs
- basenumberconverter.cs
- XsltSettings.cs
- filewebrequest.cs
- DesignerSerializationVisibilityAttribute.cs
- ProviderSettingsCollection.cs
- XmlNavigatorStack.cs
- IntellisenseTextBox.designer.cs
- WsatConfiguration.cs
- BaseParagraph.cs
- DoubleLinkList.cs
- CompilerParameters.cs
- StateBag.cs
- XsltOutput.cs
- MappingModelBuildProvider.cs
- TextDecorationUnitValidation.cs
- CacheHelper.cs
- CodeNamespaceImportCollection.cs
- DesignerActionMethodItem.cs
- MailSettingsSection.cs
- CodeAttributeArgument.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- PropertyMetadata.cs
- DesignBinding.cs
- SwitchAttribute.cs
- ObjectQueryExecutionPlan.cs
- BooleanFunctions.cs
- ModelFactory.cs
- ZipFileInfo.cs
- PaintValueEventArgs.cs
- SafeLocalMemHandle.cs
- PhonemeConverter.cs
- ApplicationGesture.cs