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
- Selector.cs
- QilInvokeEarlyBound.cs
- TreeNodeCollectionEditor.cs
- SystemThemeKey.cs
- CellPartitioner.cs
- InfiniteTimeSpanConverter.cs
- FloatSumAggregationOperator.cs
- RowToFieldTransformer.cs
- EncodingInfo.cs
- PixelFormatConverter.cs
- UIElementParaClient.cs
- ExecutionContext.cs
- EndpointDiscoveryBehavior.cs
- AnnotationResourceChangedEventArgs.cs
- ToolStripItemRenderEventArgs.cs
- Types.cs
- ResponseBodyWriter.cs
- ListSourceHelper.cs
- SetStoryboardSpeedRatio.cs
- EdmItemError.cs
- PropertyState.cs
- SessionStateModule.cs
- NullReferenceException.cs
- DesignerActionKeyboardBehavior.cs
- BufferedStream.cs
- InternalPermissions.cs
- AppSettings.cs
- TextBoxBase.cs
- DetailsViewDeletedEventArgs.cs
- RectAnimation.cs
- Connector.xaml.cs
- XNodeNavigator.cs
- OleServicesContext.cs
- SynchronizedInputHelper.cs
- SoapServerProtocol.cs
- SerializationInfoEnumerator.cs
- KoreanCalendar.cs
- Type.cs
- ByteStreamMessageEncoderFactory.cs
- DataViewSettingCollection.cs
- BrushMappingModeValidation.cs
- srgsitem.cs
- DataServiceOperationContext.cs
- newitemfactory.cs
- TableParaClient.cs
- FontFamilyIdentifier.cs
- DataGridViewSortCompareEventArgs.cs
- DataGridViewColumnConverter.cs
- BufferedOutputStream.cs
- ParentQuery.cs
- SqlCommandBuilder.cs
- FilterException.cs
- AssemblyNameProxy.cs
- ProcessHostConfigUtils.cs
- EnumerableRowCollection.cs
- SqlTransaction.cs
- DataGrid.cs
- ItemType.cs
- PolyQuadraticBezierSegment.cs
- ReachDocumentReferenceSerializerAsync.cs
- Scripts.cs
- FileSystemEventArgs.cs
- InstancePersistence.cs
- Matrix.cs
- OutputCacheModule.cs
- ItemCheckEvent.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- StateDesigner.Layouts.cs
- KeyInfo.cs
- SimpleRecyclingCache.cs
- SerializationTrace.cs
- OdbcReferenceCollection.cs
- DbConnectionStringBuilder.cs
- SymbolEqualComparer.cs
- DataGridAddNewRow.cs
- BitmapEffectGeneralTransform.cs
- FixedPage.cs
- PathFigureCollectionValueSerializer.cs
- Triangle.cs
- NumberAction.cs
- DecimalConverter.cs
- Transform.cs
- SqlRowUpdatingEvent.cs
- TaskFormBase.cs
- DataTablePropertyDescriptor.cs
- AliasedSlot.cs
- MultilineStringConverter.cs
- TableLayoutColumnStyleCollection.cs
- RawMouseInputReport.cs
- MachineSettingsSection.cs
- RequestDescription.cs
- EmptyElement.cs
- XMLSchema.cs
- EndPoint.cs
- AngleUtil.cs
- XmlDataDocument.cs
- ChangesetResponse.cs
- TargetInvocationException.cs
- codemethodreferenceexpression.cs
- CFStream.cs