Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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;
///
///
/// Manages a collection of objects.
///
///
[
ClassInterface(ClassInterfaceType.AutoDispatch),
ComVisible(true),
Serializable,
]
public class CodeNamespaceImportCollection : IList {
private ArrayList data = new ArrayList();
private Hashtable keys = new Hashtable(StringComparer.OrdinalIgnoreCase);
///
///
/// Indexer method that provides collection access.
///
///
public CodeNamespaceImport this[int index] {
get {
return ((CodeNamespaceImport)data[index]);
}
set {
data[index] = value;
SyncKeys();
}
}
///
///
/// Gets or sets the number of namespaces in the collection.
///
///
public int Count {
get {
return data.Count;
}
}
///
bool IList.IsReadOnly
{
get
{
return false;
}
}
///
bool IList.IsFixedSize
{
get
{
return false;
}
}
///
///
/// Adds a namespace import to the collection.
///
///
public void Add(CodeNamespaceImport value) {
if (!keys.ContainsKey(value.Namespace)) {
keys[value.Namespace] = value;
data.Add(value);
}
}
///
///
/// Adds a set of objects to the collection.
///
///
public void AddRange(CodeNamespaceImport[] value) {
if (value == null) {
throw new ArgumentNullException("value");
}
foreach (CodeNamespaceImport c in value) {
Add(c);
}
}
///
///
/// Clears the collection of members.
///
///
public void Clear() {
data.Clear();
keys.Clear();
}
///
///
/// Makes the collection of keys synchronised with the data.
///
///
private void SyncKeys() {
keys = new Hashtable(StringComparer.OrdinalIgnoreCase);
foreach(CodeNamespaceImport c in this) {
keys[c.Namespace] = c;
}
}
///
///
/// Gets an enumerator that enumerates the collection members.
///
///
public IEnumerator GetEnumerator() {
return data.GetEnumerator();
}
///
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();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// 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;
///
///
/// Manages a collection of objects.
///
///
[
ClassInterface(ClassInterfaceType.AutoDispatch),
ComVisible(true),
Serializable,
]
public class CodeNamespaceImportCollection : IList {
private ArrayList data = new ArrayList();
private Hashtable keys = new Hashtable(StringComparer.OrdinalIgnoreCase);
///
///
/// Indexer method that provides collection access.
///
///
public CodeNamespaceImport this[int index] {
get {
return ((CodeNamespaceImport)data[index]);
}
set {
data[index] = value;
SyncKeys();
}
}
///
///
/// Gets or sets the number of namespaces in the collection.
///
///
public int Count {
get {
return data.Count;
}
}
///
bool IList.IsReadOnly
{
get
{
return false;
}
}
///
bool IList.IsFixedSize
{
get
{
return false;
}
}
///
///
/// Adds a namespace import to the collection.
///
///
public void Add(CodeNamespaceImport value) {
if (!keys.ContainsKey(value.Namespace)) {
keys[value.Namespace] = value;
data.Add(value);
}
}
///
///
/// Adds a set of objects to the collection.
///
///
public void AddRange(CodeNamespaceImport[] value) {
if (value == null) {
throw new ArgumentNullException("value");
}
foreach (CodeNamespaceImport c in value) {
Add(c);
}
}
///
///
/// Clears the collection of members.
///
///
public void Clear() {
data.Clear();
keys.Clear();
}
///
///
/// Makes the collection of keys synchronised with the data.
///
///
private void SyncKeys() {
keys = new Hashtable(StringComparer.OrdinalIgnoreCase);
foreach(CodeNamespaceImport c in this) {
keys[c.Namespace] = c;
}
}
///
///
/// Gets an enumerator that enumerates the collection members.
///
///
public IEnumerator GetEnumerator() {
return data.GetEnumerator();
}
///
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();
}
}
}
// 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
- DefaultIfEmptyQueryOperator.cs
- SspiSecurityTokenParameters.cs
- TextServicesHost.cs
- FastPropertyAccessor.cs
- ParameterToken.cs
- ToolStripRenderEventArgs.cs
- SqlBooleanizer.cs
- WebControlParameterProxy.cs
- SecurityTokenRequirement.cs
- DefaultTraceListener.cs
- userdatakeys.cs
- SelectedDatesCollection.cs
- PreProcessor.cs
- WorkflowRuntimeServiceElement.cs
- ProxyFragment.cs
- ProviderException.cs
- DependsOnAttribute.cs
- TextTreeText.cs
- ADMembershipProvider.cs
- Html32TextWriter.cs
- SqlVersion.cs
- _StreamFramer.cs
- WebBrowserProgressChangedEventHandler.cs
- HostedBindingBehavior.cs
- OverrideMode.cs
- ComponentDispatcherThread.cs
- CodeCommentStatement.cs
- SafeArrayRankMismatchException.cs
- FieldBuilder.cs
- InheritanceContextHelper.cs
- HtmlMobileTextWriter.cs
- ClockGroup.cs
- PerformanceCounter.cs
- Validator.cs
- RuntimeConfig.cs
- TaiwanCalendar.cs
- ThumbButtonInfoCollection.cs
- XmlSerializerSection.cs
- ResourceDescriptionAttribute.cs
- BypassElementCollection.cs
- ParseElement.cs
- SqlDataAdapter.cs
- WorkflowMarkupSerializationManager.cs
- DataGridItemCollection.cs
- VerbConverter.cs
- _HeaderInfo.cs
- TextTreeRootNode.cs
- Errors.cs
- PersonalizationStateQuery.cs
- URL.cs
- WebServiceEndpoint.cs
- CollectionExtensions.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- BCryptSafeHandles.cs
- DataControlFieldTypeEditor.cs
- HttpCacheVaryByContentEncodings.cs
- _UriTypeConverter.cs
- AssemblyResolver.cs
- SqlTriggerContext.cs
- CheckBox.cs
- AttributeInfo.cs
- _NestedMultipleAsyncResult.cs
- RegexGroup.cs
- WebRequestModuleElement.cs
- COM2IPerPropertyBrowsingHandler.cs
- safelinkcollection.cs
- UpdateTranslator.cs
- TransformFinalBlockRequest.cs
- MarshalByRefObject.cs
- SiteMapPath.cs
- Input.cs
- XsdDataContractImporter.cs
- WebPartConnectionsCloseVerb.cs
- X509SecurityTokenAuthenticator.cs
- InternalConfigHost.cs
- TemplateXamlTreeBuilder.cs
- PermissionSetTriple.cs
- SessionParameter.cs
- DataGridViewDataConnection.cs
- SafeCancelMibChangeNotify.cs
- AssemblyNameProxy.cs
- StyleTypedPropertyAttribute.cs
- CollectionDataContractAttribute.cs
- ToolStripSplitButton.cs
- SignatureHelper.cs
- ReferenceList.cs
- ByeMessageCD1.cs
- WorkflowViewElement.cs
- SqlDataAdapter.cs
- PerspectiveCamera.cs
- DictionaryEditChange.cs
- PersonalizationStateInfo.cs
- WebPartPersonalization.cs
- Bezier.cs
- EntityContainer.cs
- XmlDataLoader.cs
- WebRequestModulesSection.cs
- SHA384.cs
- AnnotationComponentChooser.cs
- GridViewColumnCollection.cs