Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / CodeDOM / CodeNamespaceImportCollection.cs / 1 / CodeNamespaceImportCollection.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.CodeDom { using System.Diagnostics; using System; using System.Collections; using System.Runtime.InteropServices; using System.Globalization; ////// [ ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable, ] public class CodeNamespaceImportCollection : IList { private ArrayList data = new ArrayList(); private Hashtable keys = new Hashtable(StringComparer.OrdinalIgnoreCase); ////// Manages a collection of ///objects. /// /// public CodeNamespaceImport this[int index] { get { return ((CodeNamespaceImport)data[index]); } set { data[index] = value; SyncKeys(); } } ////// Indexer method that provides collection access. /// ////// public int Count { get { return data.Count; } } ////// Gets or sets the number of namespaces in the collection. /// ///bool IList.IsReadOnly { get { return false; } } /// bool IList.IsFixedSize { get { return false; } } /// /// public void Add(CodeNamespaceImport value) { if (!keys.ContainsKey(value.Namespace)) { keys[value.Namespace] = value; data.Add(value); } } ////// Adds a namespace import to the collection. /// ////// public void AddRange(CodeNamespaceImport[] value) { if (value == null) { throw new ArgumentNullException("value"); } foreach (CodeNamespaceImport c in value) { Add(c); } } ////// Adds a set of ///objects to the collection. /// /// public void Clear() { data.Clear(); keys.Clear(); } ////// Clears the collection of members. /// ////// private void SyncKeys() { keys = new Hashtable(StringComparer.OrdinalIgnoreCase); foreach(CodeNamespaceImport c in this) { keys[c.Namespace] = c; } } ////// Makes the collection of keys synchronised with the data. /// ////// public IEnumerator GetEnumerator() { return data.GetEnumerator(); } ////// Gets an enumerator that enumerates the collection members. /// ///object IList.this[int index] { get { return this[index]; } set { this[index] = (CodeNamespaceImport)value; SyncKeys(); } } /// int ICollection.Count { get { return Count; } } /// bool ICollection.IsSynchronized { get { return false; } } /// object ICollection.SyncRoot { get { return null; } } /// void ICollection.CopyTo(Array array, int index) { data.CopyTo(array, index); } /// IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// int IList.Add(object value) { return data.Add((CodeNamespaceImport)value); } /// void IList.Clear() { Clear(); } /// bool IList.Contains(object value) { return data.Contains(value); } /// int IList.IndexOf(object value) { return data.IndexOf((CodeNamespaceImport)value); } /// void IList.Insert(int index, object value) { data.Insert(index, (CodeNamespaceImport)value); SyncKeys(); } /// void IList.Remove(object value) { data.Remove((CodeNamespaceImport)value); SyncKeys(); } /// void IList.RemoveAt(int index) { data.RemoveAt(index); SyncKeys(); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DefaultTextStore.cs
- DocumentAutomationPeer.cs
- RowToFieldTransformer.cs
- GenericUriParser.cs
- LookupBindingPropertiesAttribute.cs
- QuotedPrintableStream.cs
- SemanticResultValue.cs
- XamlReaderHelper.cs
- ControlAdapter.cs
- ToolboxService.cs
- DescriptionAttribute.cs
- ZoneMembershipCondition.cs
- MinimizableAttributeTypeConverter.cs
- MarkupProperty.cs
- HwndSourceParameters.cs
- SqlDataSourceCommandEventArgs.cs
- InternalConfigEventArgs.cs
- EdmConstants.cs
- Rules.cs
- NavigatingCancelEventArgs.cs
- CheckBox.cs
- lengthconverter.cs
- SwitchAttribute.cs
- CursorInteropHelper.cs
- LocalValueEnumerator.cs
- EdmRelationshipRoleAttribute.cs
- SyntaxCheck.cs
- WebRequest.cs
- ComplusTypeValidator.cs
- FederatedMessageSecurityOverHttpElement.cs
- LineGeometry.cs
- SByteConverter.cs
- SqlFunctionAttribute.cs
- LongPath.cs
- InteropBitmapSource.cs
- DataGridHelper.cs
- MatchingStyle.cs
- DropDownList.cs
- Permission.cs
- CrossSiteScriptingValidation.cs
- httpapplicationstate.cs
- SemanticBasicElement.cs
- SchemaObjectWriter.cs
- ScriptManagerProxy.cs
- ScriptReference.cs
- PolicyException.cs
- LineBreakRecord.cs
- MsmqReceiveHelper.cs
- MenuItemAutomationPeer.cs
- ObjectDataSourceMethodEventArgs.cs
- EventWaitHandle.cs
- RangeValuePattern.cs
- BuildManagerHost.cs
- XmlSchemaInferenceException.cs
- DefaultSettingsSection.cs
- PermissionListSet.cs
- DockPattern.cs
- ComboBox.cs
- SingleSelectRootGridEntry.cs
- SchemaSetCompiler.cs
- ChannelDemuxer.cs
- ErrorsHelper.cs
- ControlPropertyNameConverter.cs
- DataGridViewCheckBoxCell.cs
- AppDomainAttributes.cs
- SrgsRule.cs
- CatalogZone.cs
- WorkflowServiceHost.cs
- TextEndOfSegment.cs
- SimpleTextLine.cs
- ColumnMapCopier.cs
- WebPartAddingEventArgs.cs
- DigestTraceRecordHelper.cs
- IgnoreFileBuildProvider.cs
- ActivityExecutorDelegateInfo.cs
- Int32AnimationBase.cs
- PathGradientBrush.cs
- StrokeCollectionDefaultValueFactory.cs
- CssClassPropertyAttribute.cs
- SafeProcessHandle.cs
- XmlILAnnotation.cs
- MdImport.cs
- ObjRef.cs
- CodeCompileUnit.cs
- RolePrincipal.cs
- UInt64.cs
- ConstructorArgumentAttribute.cs
- ConstructorArgumentAttribute.cs
- ObjectDisposedException.cs
- filewebresponse.cs
- ProviderSettings.cs
- CacheHelper.cs
- WindowInteropHelper.cs
- DispatcherProcessingDisabled.cs
- CharEntityEncoderFallback.cs
- ComponentConverter.cs
- GPStream.cs
- FieldToken.cs
- DiscreteKeyFrames.cs
- DBCSCodePageEncoding.cs