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
- PriorityChain.cs
- ResourceDisplayNameAttribute.cs
- HtmlInputImage.cs
- ColumnHeader.cs
- XmlElementList.cs
- InputReport.cs
- StylusEditingBehavior.cs
- _ChunkParse.cs
- ImageUrlEditor.cs
- SoapInteropTypes.cs
- CommonDialog.cs
- OdbcParameterCollection.cs
- OleDbConnection.cs
- BufferModeSettings.cs
- SqlNodeTypeOperators.cs
- PlanCompiler.cs
- Itemizer.cs
- Triplet.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- GridViewDeletedEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- unitconverter.cs
- ListViewContainer.cs
- XmlHierarchicalDataSourceView.cs
- QuarticEase.cs
- JsonDataContract.cs
- OnOperation.cs
- SendActivityDesigner.cs
- BuilderInfo.cs
- BaseConfigurationRecord.cs
- Latin1Encoding.cs
- PropertyToken.cs
- DesignerResources.cs
- Matrix.cs
- EntryPointNotFoundException.cs
- ExtentJoinTreeNode.cs
- CompensateDesigner.cs
- GraphicsContainer.cs
- OleServicesContext.cs
- DateTimeSerializationSection.cs
- SqlWebEventProvider.cs
- ContentPlaceHolder.cs
- MetadataUtilsSmi.cs
- CryptographicAttribute.cs
- DataGridViewTextBoxCell.cs
- ChannelDispatcherBase.cs
- QilInvoke.cs
- ListSourceHelper.cs
- MimeFormImporter.cs
- CompoundFileStreamReference.cs
- WebPartDesigner.cs
- selecteditemcollection.cs
- EdmToObjectNamespaceMap.cs
- SourceElementsCollection.cs
- RewritingSimplifier.cs
- ResXResourceSet.cs
- BufferedGraphicsContext.cs
- ChannelManager.cs
- DataObjectAttribute.cs
- XmlChildEnumerator.cs
- securestring.cs
- SqlFunctions.cs
- EmptyTextWriter.cs
- Parameter.cs
- DashStyle.cs
- TextCharacters.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- SqlNodeAnnotations.cs
- ServiceOperationParameter.cs
- FontStretches.cs
- Evaluator.cs
- OdbcParameter.cs
- XmlToDatasetMap.cs
- CheckBox.cs
- Int16AnimationUsingKeyFrames.cs
- XmlQuerySequence.cs
- FilterableData.cs
- WebPartMovingEventArgs.cs
- EventProxy.cs
- SiteMapProvider.cs
- MexBindingBindingCollectionElement.cs
- StructuredTypeEmitter.cs
- SqlUtil.cs
- precedingquery.cs
- IListConverters.cs
- ACE.cs
- DataMemberListEditor.cs
- ToolStripManager.cs
- StickyNote.cs
- IgnoreSectionHandler.cs
- ItemContainerPattern.cs
- WebAdminConfigurationHelper.cs
- SettingsAttributes.cs
- Debug.cs
- DataView.cs
- RepeaterItemCollection.cs
- MethodCallConverter.cs
- AddInSegmentDirectoryNotFoundException.cs
- PieceNameHelper.cs
- CodeAttributeArgumentCollection.cs