Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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.
//
// [....]
//-----------------------------------------------------------------------------
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InterleavedZipPartStream.cs
- FrameDimension.cs
- BehaviorEditorPart.cs
- ChannelPoolSettings.cs
- PrintingPermission.cs
- ColumnResizeAdorner.cs
- Int64Animation.cs
- FragmentQueryKB.cs
- UnsafeCollabNativeMethods.cs
- WebPartConnectionsEventArgs.cs
- ISO2022Encoding.cs
- DetailsViewPagerRow.cs
- recordstate.cs
- ActionFrame.cs
- Control.cs
- SystemColors.cs
- XmlSchemaElement.cs
- StatusBarPanel.cs
- Binding.cs
- MULTI_QI.cs
- FilterQuery.cs
- TriggerActionCollection.cs
- TreeNodeConverter.cs
- Command.cs
- XmlSchemaAny.cs
- PackWebRequestFactory.cs
- MiniModule.cs
- IdentityHolder.cs
- FontUnit.cs
- EmbeddedMailObject.cs
- TextTrailingCharacterEllipsis.cs
- CancelRequestedRecord.cs
- KnownTypes.cs
- Logging.cs
- Vector3DConverter.cs
- ApplicationCommands.cs
- OletxEnlistment.cs
- AssemblyCache.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- CollectionCodeDomSerializer.cs
- Formatter.cs
- Roles.cs
- BamlResourceContent.cs
- Zone.cs
- ValidatorCompatibilityHelper.cs
- Timer.cs
- IPHostEntry.cs
- DrawItemEvent.cs
- FontWeightConverter.cs
- EncoderParameters.cs
- DefaultTextStoreTextComposition.cs
- ContentPlaceHolder.cs
- FrameworkElement.cs
- FontClient.cs
- StringInfo.cs
- ByteFacetDescriptionElement.cs
- ArrayMergeHelper.cs
- ISAPIApplicationHost.cs
- OperationValidationEventArgs.cs
- TextBox.cs
- DataGridViewRow.cs
- DataGridViewTextBoxCell.cs
- SmiXetterAccessMap.cs
- FileSystemEventArgs.cs
- ReflectionUtil.cs
- XPathNavigatorKeyComparer.cs
- WriteTimeStream.cs
- ProfilePropertySettingsCollection.cs
- Odbc32.cs
- WebPartsPersonalization.cs
- DoubleLinkList.cs
- HttpClientCertificate.cs
- BrowserInteropHelper.cs
- CodeCommentStatementCollection.cs
- ToolStripLabel.cs
- TextViewElement.cs
- EntityDataSourceChangedEventArgs.cs
- XamlSerializerUtil.cs
- FullTrustAssembliesSection.cs
- Point3D.cs
- DbProviderManifest.cs
- ColumnMapTranslator.cs
- ParseHttpDate.cs
- CharKeyFrameCollection.cs
- ClientTargetSection.cs
- DataIdProcessor.cs
- Rotation3DAnimation.cs
- Wildcard.cs
- XmlAttributeCollection.cs
- DetailsViewInsertEventArgs.cs
- SymbolResolver.cs
- DataTemplate.cs
- DatatypeImplementation.cs
- StorageAssociationSetMapping.cs
- BezierSegment.cs
- HuffmanTree.cs
- Util.cs
- DesignerTransactionCloseEvent.cs
- OperationCanceledException.cs
- smtppermission.cs