Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- WorkflowMessageEventHandler.cs
- StylusOverProperty.cs
- TreeViewBindingsEditor.cs
- HtmlImage.cs
- SspiNegotiationTokenAuthenticatorState.cs
- IPEndPoint.cs
- EntityParameter.cs
- Identifier.cs
- UserMapPath.cs
- GestureRecognizer.cs
- DataGridViewCell.cs
- DataGridViewTopLeftHeaderCell.cs
- ECDsaCng.cs
- TraceShell.cs
- ExpressionSelection.cs
- QuaternionAnimation.cs
- TextSelectionProcessor.cs
- Function.cs
- SqlVisitor.cs
- QualificationDataItem.cs
- QueueProcessor.cs
- _NegotiateClient.cs
- IResourceProvider.cs
- ProxyWebPartConnectionCollection.cs
- SortKey.cs
- PassportPrincipal.cs
- Triplet.cs
- GroupStyle.cs
- WebServicesDescriptionAttribute.cs
- XmlResolver.cs
- _ScatterGatherBuffers.cs
- MD5.cs
- DataObjectSettingDataEventArgs.cs
- WebPartChrome.cs
- ButtonRenderer.cs
- XamlGridLengthSerializer.cs
- AttachedPropertyBrowsableAttribute.cs
- GeneralTransform3D.cs
- DocumentSignatureManager.cs
- DecoratedNameAttribute.cs
- MDIControlStrip.cs
- XmlDataLoader.cs
- Utils.cs
- ProtocolElementCollection.cs
- DataGridTablesFactory.cs
- CompositeActivityMarkupSerializer.cs
- SmtpException.cs
- MouseGestureConverter.cs
- FileIOPermission.cs
- ContentDisposition.cs
- AddInToken.cs
- XmlWrappingReader.cs
- SimpleRecyclingCache.cs
- Certificate.cs
- ProviderManager.cs
- StatusBar.cs
- WebPartZoneCollection.cs
- TextWriterEngine.cs
- FormatterServices.cs
- TransactedReceiveScope.cs
- CultureTable.cs
- CheckBoxBaseAdapter.cs
- SpanIndex.cs
- columnmapfactory.cs
- MissingFieldException.cs
- CharKeyFrameCollection.cs
- OdbcPermission.cs
- TypeDelegator.cs
- _AutoWebProxyScriptEngine.cs
- Point3DValueSerializer.cs
- CalendarDateChangedEventArgs.cs
- BamlCollectionHolder.cs
- RtfToXamlLexer.cs
- Int32Converter.cs
- OleStrCAMarshaler.cs
- Window.cs
- Journaling.cs
- XmlProcessingInstruction.cs
- VScrollProperties.cs
- PersonalizablePropertyEntry.cs
- MarkupProperty.cs
- EntityException.cs
- Menu.cs
- BaseTemplateCodeDomTreeGenerator.cs
- NameTable.cs
- ColorMatrix.cs
- SHA1CryptoServiceProvider.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- NonClientArea.cs
- MailWriter.cs
- NumericUpDown.cs
- _FtpControlStream.cs
- PopupEventArgs.cs
- ObjectListCommandEventArgs.cs
- ViewgenContext.cs
- DataTableMappingCollection.cs
- SqlClientPermission.cs
- ModelUIElement3D.cs
- TextDecoration.cs
- CustomDictionarySources.cs