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
- OuterGlowBitmapEffect.cs
- NonBatchDirectoryCompiler.cs
- MarkupProperty.cs
- KeyConstraint.cs
- ConfigurationSection.cs
- Control.cs
- IxmlLineInfo.cs
- DocumentGridPage.cs
- BitmapImage.cs
- SmtpTransport.cs
- RewritingPass.cs
- FileFormatException.cs
- FileDataSourceCache.cs
- TraceListeners.cs
- ImageAutomationPeer.cs
- PropertyValueUIItem.cs
- DrawingAttributeSerializer.cs
- MessageEnumerator.cs
- SettingsAttributeDictionary.cs
- DrawingContext.cs
- SchemaTableOptionalColumn.cs
- XamlFrame.cs
- DataTableNewRowEvent.cs
- _AutoWebProxyScriptHelper.cs
- ProfilePropertyNameValidator.cs
- Int64Converter.cs
- AxParameterData.cs
- BinaryParser.cs
- CloudCollection.cs
- TextBox.cs
- RequiredFieldValidator.cs
- ManipulationStartedEventArgs.cs
- WindowsBrush.cs
- ExpressionTable.cs
- RegexCaptureCollection.cs
- RuleRef.cs
- LockedAssemblyCache.cs
- RectAnimation.cs
- FormatterConverter.cs
- AuthenticationException.cs
- DetailsViewCommandEventArgs.cs
- ExceptQueryOperator.cs
- RegexBoyerMoore.cs
- ReadOnlyKeyedCollection.cs
- ComponentCommands.cs
- PtsPage.cs
- GroupQuery.cs
- SubMenuStyle.cs
- DebugView.cs
- ControlValuePropertyAttribute.cs
- ISO2022Encoding.cs
- ScrollProviderWrapper.cs
- ActivityBindForm.cs
- SqlDataReaderSmi.cs
- ColorConvertedBitmap.cs
- OptimisticConcurrencyException.cs
- SqlServices.cs
- ContextMenuAutomationPeer.cs
- ReverseInheritProperty.cs
- UriTemplateCompoundPathSegment.cs
- DifferencingCollection.cs
- CodeTypeOfExpression.cs
- WebPartVerb.cs
- FileSecurity.cs
- Application.cs
- PropertyChangedEventManager.cs
- DBNull.cs
- ActivityLocationReferenceEnvironment.cs
- COAUTHIDENTITY.cs
- XmlDictionary.cs
- RIPEMD160.cs
- EntityRecordInfo.cs
- Double.cs
- Scalars.cs
- SpeechRecognizer.cs
- RecognizedWordUnit.cs
- RichTextBoxDesigner.cs
- RangeBaseAutomationPeer.cs
- DBSchemaTable.cs
- Timer.cs
- NamespaceMapping.cs
- CurrencyManager.cs
- PolicyValidationException.cs
- MsmqIntegrationBinding.cs
- ObjectDataSourceSelectingEventArgs.cs
- CodeGen.cs
- ContextProperty.cs
- TextTreeExtractElementUndoUnit.cs
- BitConverter.cs
- XmlSchemaSimpleTypeList.cs
- typedescriptorpermissionattribute.cs
- _BufferOffsetSize.cs
- HtmlInputRadioButton.cs
- __FastResourceComparer.cs
- CachingHintValidation.cs
- RadioButtonStandardAdapter.cs
- NeutralResourcesLanguageAttribute.cs
- DoubleAnimationClockResource.cs
- CodeTypeDelegate.cs
- UnitySerializationHolder.cs