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
- Win32PrintDialog.cs
- TextBox.cs
- TextRangeBase.cs
- UInt16Storage.cs
- mediaeventshelper.cs
- CharEnumerator.cs
- NetPeerTcpBindingCollectionElement.cs
- AlternateViewCollection.cs
- QueryContinueDragEventArgs.cs
- AuthenticationConfig.cs
- XmlEntity.cs
- OdbcUtils.cs
- WorkflowApplicationTerminatedException.cs
- ListViewGroupItemCollection.cs
- odbcmetadatacollectionnames.cs
- IndicCharClassifier.cs
- XamlToRtfWriter.cs
- MappingSource.cs
- X509CertificateCollection.cs
- CachingHintValidation.cs
- ServiceDebugElement.cs
- DynamicUpdateCommand.cs
- FontCollection.cs
- DataGridViewCellCancelEventArgs.cs
- Stroke2.cs
- CompilerLocalReference.cs
- StylusDevice.cs
- XmlILAnnotation.cs
- HttpWebRequestElement.cs
- EntityRecordInfo.cs
- Utilities.cs
- RectangleHotSpot.cs
- webclient.cs
- DataError.cs
- AmbientLight.cs
- AutomationPropertyChangedEventArgs.cs
- ObservableCollection.cs
- PtsContext.cs
- PeerObject.cs
- ParameterCollectionEditorForm.cs
- StateRuntime.cs
- MessageBox.cs
- PageCodeDomTreeGenerator.cs
- ToolTipService.cs
- PolyQuadraticBezierSegment.cs
- DES.cs
- HostProtectionPermission.cs
- InternalMappingException.cs
- RuleSettings.cs
- Comparer.cs
- BookmarkInfo.cs
- RegionIterator.cs
- Byte.cs
- PartialToken.cs
- DBSqlParserTable.cs
- COMException.cs
- OracleTimeSpan.cs
- HtmlElementEventArgs.cs
- AssemblyInfo.cs
- EmptyQuery.cs
- EntityWithKeyStrategy.cs
- Sql8ConformanceChecker.cs
- SmtpCommands.cs
- SqlTopReducer.cs
- FactoryId.cs
- RangeValidator.cs
- AccessDataSourceView.cs
- HtmlElement.cs
- CodeCastExpression.cs
- ObsoleteAttribute.cs
- PrintingPermissionAttribute.cs
- MeasureItemEvent.cs
- NamespaceDecl.cs
- WpfKnownMemberInvoker.cs
- Track.cs
- SiteMapDataSourceView.cs
- PropertyMetadata.cs
- RC2.cs
- VerticalAlignConverter.cs
- ThrowHelper.cs
- SqlConnectionString.cs
- AndCondition.cs
- InputLangChangeRequestEvent.cs
- Vector3DAnimation.cs
- Win32.cs
- CollectionChangeEventArgs.cs
- XmlNamespaceMappingCollection.cs
- TypeTypeConverter.cs
- VisualTreeFlattener.cs
- COM2PropertyPageUITypeConverter.cs
- DataGridViewRowEventArgs.cs
- CodeComment.cs
- wmiprovider.cs
- ToolStripSeparatorRenderEventArgs.cs
- TheQuery.cs
- DocumentEventArgs.cs
- SmiEventSink_DeferedProcessing.cs
- ListManagerBindingsCollection.cs
- SystemIPv4InterfaceProperties.cs
- SecurityElementBase.cs