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
- CqlIdentifiers.cs
- CharacterMetricsDictionary.cs
- GlyphRunDrawing.cs
- TimeSpanStorage.cs
- Timeline.cs
- ImageCodecInfoPrivate.cs
- CodeParameterDeclarationExpression.cs
- TextTreeTextBlock.cs
- HtmlListAdapter.cs
- StringResourceManager.cs
- ScriptingJsonSerializationSection.cs
- Logging.cs
- CmsInterop.cs
- ConnectionStringsExpressionBuilder.cs
- CapabilitiesAssignment.cs
- SubpageParagraph.cs
- InvalidateEvent.cs
- SchemaElementDecl.cs
- ScriptComponentDescriptor.cs
- ContentElement.cs
- CalendarSelectionChangedEventArgs.cs
- UpdateCompiler.cs
- ObsoleteAttribute.cs
- ChildChangedEventArgs.cs
- TimeZoneInfo.cs
- SerialPort.cs
- XmlIncludeAttribute.cs
- FamilyMapCollection.cs
- XmlSchemaAnnotated.cs
- BitmapEffectGeneralTransform.cs
- Win32KeyboardDevice.cs
- QilScopedVisitor.cs
- OletxVolatileEnlistment.cs
- NumericPagerField.cs
- XmlIgnoreAttribute.cs
- SingleKeyFrameCollection.cs
- ManagementOperationWatcher.cs
- nulltextcontainer.cs
- RawStylusSystemGestureInputReport.cs
- VisualBrush.cs
- FigureParaClient.cs
- HtmlTextArea.cs
- ProxyManager.cs
- PartialList.cs
- SoapTypeAttribute.cs
- XmlTextReaderImplHelpers.cs
- TextTabProperties.cs
- HorizontalAlignConverter.cs
- WebPermission.cs
- ResourceDescriptionAttribute.cs
- DesignerWebPartChrome.cs
- UnsafeNativeMethodsPenimc.cs
- SequentialWorkflowHeaderFooter.cs
- OleAutBinder.cs
- DataGridViewMethods.cs
- PointLight.cs
- HttpCapabilitiesEvaluator.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- DoubleLinkList.cs
- DirtyTextRange.cs
- DiscoveryClientDuplexChannel.cs
- AttributeXamlType.cs
- Evidence.cs
- Tile.cs
- PermissionToken.cs
- TraceData.cs
- PrinterSettings.cs
- FillRuleValidation.cs
- RelatedPropertyManager.cs
- InvokeHandlers.cs
- Visual3DCollection.cs
- StateMachineSubscriptionManager.cs
- PathFigureCollectionValueSerializer.cs
- DesignColumn.cs
- GridViewActionList.cs
- CapabilitiesPattern.cs
- SqlGenericUtil.cs
- DynamicPropertyReader.cs
- IntegerFacetDescriptionElement.cs
- DbModificationClause.cs
- BinaryParser.cs
- BaseResourcesBuildProvider.cs
- AsymmetricKeyExchangeFormatter.cs
- DependencyPropertyKey.cs
- LongPath.cs
- WebServiceMethodData.cs
- oledbmetadatacollectionnames.cs
- PageVisual.cs
- StorageInfo.cs
- Clipboard.cs
- StickyNoteContentControl.cs
- GlyphCache.cs
- Peer.cs
- _ListenerRequestStream.cs
- SoapFormatter.cs
- SQLInt32Storage.cs
- PolyLineSegment.cs
- CatalogPart.cs
- WorkflowStateRollbackService.cs
- TreeNodeStyleCollection.cs