Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ExpandoObject.cs
- DataGridItemEventArgs.cs
- KeyToListMap.cs
- XPathAxisIterator.cs
- VariableAction.cs
- ModuleBuilderData.cs
- ImageCollectionEditor.cs
- EntityDataSourceUtil.cs
- DataGridViewCellValidatingEventArgs.cs
- EntityCodeGenerator.cs
- LayoutExceptionEventArgs.cs
- VisualStyleInformation.cs
- DateTimeFormat.cs
- XmlSerializationWriter.cs
- XmlExceptionHelper.cs
- ObsoleteAttribute.cs
- ConnectionManagementSection.cs
- BasicViewGenerator.cs
- Rijndael.cs
- DesignUtil.cs
- ObjectStateManagerMetadata.cs
- HttpBufferlessInputStream.cs
- PointLight.cs
- CssClassPropertyAttribute.cs
- OleDbStruct.cs
- CodeTypeReferenceSerializer.cs
- Empty.cs
- IconBitmapDecoder.cs
- CodeSubDirectory.cs
- FixUpCollection.cs
- AssemblyCache.cs
- DataGridTablesFactory.cs
- MultiAsyncResult.cs
- HtmlMobileTextWriter.cs
- TextAutomationPeer.cs
- PeerNameRegistration.cs
- PickDesigner.xaml.cs
- NavigationPropertyEmitter.cs
- State.cs
- XmlMembersMapping.cs
- DBConnection.cs
- HtmlInputPassword.cs
- QueryPrefixOp.cs
- UnsafeNativeMethods.cs
- CodeArrayCreateExpression.cs
- HttpWebResponse.cs
- ErrorEventArgs.cs
- TextEditorParagraphs.cs
- DataGridViewSelectedColumnCollection.cs
- WebRequestModuleElement.cs
- ModelTreeManager.cs
- TdsParserStaticMethods.cs
- ELinqQueryState.cs
- ConstructorExpr.cs
- PrintSchema.cs
- LoginName.cs
- JsonServiceDocumentSerializer.cs
- MessageBox.cs
- Span.cs
- DrawingImage.cs
- ExclusiveCanonicalizationTransform.cs
- CodeRemoveEventStatement.cs
- TlsnegoTokenAuthenticator.cs
- AssemblyBuilderData.cs
- MonthChangedEventArgs.cs
- GPRECTF.cs
- LassoHelper.cs
- DesignerVerbCollection.cs
- CodeSnippetExpression.cs
- TextElementEnumerator.cs
- contentDescriptor.cs
- HtmlTextArea.cs
- ResourceFallbackManager.cs
- ScrollEvent.cs
- GraphicsContainer.cs
- ZipPackagePart.cs
- FileDialogCustomPlacesCollection.cs
- SizeF.cs
- LongSumAggregationOperator.cs
- BitmapSource.cs
- FilterException.cs
- CookieHandler.cs
- SqlColumnizer.cs
- MatchingStyle.cs
- PermissionRequestEvidence.cs
- GcHandle.cs
- ZipFileInfo.cs
- UnmanagedHandle.cs
- XslVisitor.cs
- TextEditorSelection.cs
- LineSegment.cs
- FixedSOMSemanticBox.cs
- Code.cs
- ScrollBar.cs
- XmlNodeList.cs
- WebEventTraceProvider.cs
- ToolStripItemBehavior.cs
- ViewStateModeByIdAttribute.cs
- _IPv6Address.cs
- MultiBindingExpression.cs