Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / Serialization / NameTable.cs / 1 / NameTable.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Serialization {
using System.Collections;
internal class NameKey {
string ns;
string name;
internal NameKey(string name, string ns) {
this.name = name;
this.ns = ns;
}
public override bool Equals(object other) {
if (!(other is NameKey)) return false;
NameKey key = (NameKey)other;
return name == key.name && ns == key.ns;
}
public override int GetHashCode() {
return (ns == null ? "".GetHashCode() : ns.GetHashCode()) ^ (name == null ? 0 : name.GetHashCode());
}
}
internal interface INameScope {
object this[string name, string ns] {get; set;}
}
internal class NameTable : INameScope {
Hashtable table = new Hashtable();
internal void Add(XmlQualifiedName qname, object value) {
Add(qname.Name, qname.Namespace, value);
}
internal void Add(string name, string ns, object value) {
NameKey key = new NameKey(name, ns);
table.Add(key, value);
}
internal object this[XmlQualifiedName qname] {
get {
return table[new NameKey(qname.Name, qname.Namespace)];
}
set {
table[new NameKey(qname.Name, qname.Namespace)] = value;
}
}
internal object this[string name, string ns] {
get {
return table[new NameKey(name, ns)];
}
set {
table[new NameKey(name, ns)] = value;
}
}
object INameScope.this[string name, string ns] {
get {
return table[new NameKey(name, ns)];
}
set {
table[new NameKey(name, ns)] = value;
}
}
internal ICollection Values {
get { return table.Values; }
}
internal Array ToArray(Type type) {
Array a = Array.CreateInstance(type, table.Count);
table.Values.CopyTo(a, 0);
return a;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UIPermission.cs
- ConstraintStruct.cs
- DataGridrowEditEndingEventArgs.cs
- ValueProviderWrapper.cs
- Int64KeyFrameCollection.cs
- ParseNumbers.cs
- GiveFeedbackEventArgs.cs
- QueryProcessor.cs
- panel.cs
- StringSource.cs
- WebSysDisplayNameAttribute.cs
- WebResourceAttribute.cs
- MemoryFailPoint.cs
- OpenTypeCommon.cs
- MatrixCamera.cs
- ThreadSafeList.cs
- BamlStream.cs
- TextSchema.cs
- VirtualizedItemProviderWrapper.cs
- CompilerErrorCollection.cs
- SqlProfileProvider.cs
- EnumerableRowCollectionExtensions.cs
- SafeViewOfFileHandle.cs
- FormView.cs
- HandlerFactoryWrapper.cs
- Menu.cs
- CommonProperties.cs
- ToolStripOverflowButton.cs
- MediaScriptCommandRoutedEventArgs.cs
- StringBlob.cs
- DataGridViewLayoutData.cs
- NameValueConfigurationElement.cs
- XslCompiledTransform.cs
- EventSinkActivity.cs
- StagingAreaInputItem.cs
- ConnectionInterfaceCollection.cs
- Object.cs
- PropertyAccessVisitor.cs
- LicenseException.cs
- GestureRecognizer.cs
- DataControlFieldTypeEditor.cs
- HtmlInputImage.cs
- EntityDataSourceDataSelectionPanel.cs
- ThrowHelper.cs
- XhtmlBasicControlAdapter.cs
- FlowDocumentScrollViewer.cs
- EntityCommandDefinition.cs
- TableParaClient.cs
- ManagementBaseObject.cs
- ShaderEffect.cs
- XmlDataSource.cs
- TranslateTransform3D.cs
- XmlEventCache.cs
- ConfigXmlWhitespace.cs
- rsa.cs
- CustomAssemblyResolver.cs
- DataGridViewLinkColumn.cs
- PcmConverter.cs
- Rect3DValueSerializer.cs
- TextHidden.cs
- BodyGlyph.cs
- SpellerHighlightLayer.cs
- PenContext.cs
- SequenceDesigner.cs
- BaseParaClient.cs
- Normalization.cs
- RequestReplyCorrelator.cs
- LinqDataSourceValidationException.cs
- DataReceivedEventArgs.cs
- ClientSettingsProvider.cs
- CompressedStack.cs
- DATA_BLOB.cs
- TabControlDesigner.cs
- ProfileManager.cs
- WmlCalendarAdapter.cs
- MultipleViewPattern.cs
- ProfessionalColorTable.cs
- ContainerControl.cs
- DSACryptoServiceProvider.cs
- BaseCAMarshaler.cs
- TypeHelper.cs
- FlagsAttribute.cs
- TextReader.cs
- MsmqInputChannel.cs
- ZipIOExtraFieldZip64Element.cs
- ListViewDeletedEventArgs.cs
- ObjectContextServiceProvider.cs
- FakeModelPropertyImpl.cs
- FullTextBreakpoint.cs
- DecimalAnimation.cs
- SessionState.cs
- XsdBuildProvider.cs
- DescendentsWalkerBase.cs
- Classification.cs
- ObjectDisposedException.cs
- SqlClientWrapperSmiStreamChars.cs
- Symbol.cs
- NotSupportedException.cs
- TimeSpanConverter.cs
- VersionUtil.cs