Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / Serialization / NameTable.cs / 1305376 / 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
- DbConnectionStringBuilder.cs
- WebPartAddingEventArgs.cs
- EventProxy.cs
- XsltInput.cs
- Conditional.cs
- ApplicationSecurityManager.cs
- ObjectViewFactory.cs
- KeySplineConverter.cs
- NetworkAddressChange.cs
- SAPICategories.cs
- Queue.cs
- SqlWebEventProvider.cs
- SafeLocalMemHandle.cs
- TaskForm.cs
- SetStoryboardSpeedRatio.cs
- AnchoredBlock.cs
- Rectangle.cs
- AttributeCollection.cs
- EventHandlerList.cs
- ReflectionServiceProvider.cs
- ManagedFilter.cs
- BaseTreeIterator.cs
- ThemeableAttribute.cs
- ConstructorBuilder.cs
- X509CertificateInitiatorServiceCredential.cs
- TextElementEnumerator.cs
- TraceContextRecord.cs
- DSASignatureDeformatter.cs
- CodeArrayCreateExpression.cs
- brushes.cs
- ParseHttpDate.cs
- EditorPartCollection.cs
- RawStylusInput.cs
- unitconverter.cs
- Debug.cs
- XmlSchemaFacet.cs
- RelationshipEndMember.cs
- ServiceModelReg.cs
- TableAutomationPeer.cs
- TableLayoutPanelCellPosition.cs
- PropertyManager.cs
- TrustManagerPromptUI.cs
- Touch.cs
- RC2.cs
- CompareValidator.cs
- SemaphoreFullException.cs
- UnicastIPAddressInformationCollection.cs
- DispatcherExceptionFilterEventArgs.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- DictionaryContent.cs
- DocobjHost.cs
- Configuration.cs
- BitmapEffectInputConnector.cs
- ProfileServiceManager.cs
- DataGridCellClipboardEventArgs.cs
- FrameworkContextData.cs
- GcHandle.cs
- HiddenFieldDesigner.cs
- KeyValueConfigurationElement.cs
- ClosableStream.cs
- MarkupExtensionParser.cs
- Zone.cs
- HWStack.cs
- DatagridviewDisplayedBandsData.cs
- BasicCellRelation.cs
- SingleConverter.cs
- DynamicILGenerator.cs
- DataGridViewCellPaintingEventArgs.cs
- XNodeValidator.cs
- AppLevelCompilationSectionCache.cs
- ContainerAction.cs
- DependencySource.cs
- BinaryObjectInfo.cs
- KeyboardDevice.cs
- SoapHeaders.cs
- TypeGeneratedEventArgs.cs
- RadioButtonAutomationPeer.cs
- ProxyAssemblyNotLoadedException.cs
- MimePart.cs
- StatusBarDrawItemEvent.cs
- RepeaterItem.cs
- RootDesignerSerializerAttribute.cs
- ObjectQueryState.cs
- RuntimeEnvironment.cs
- X509CertificateClaimSet.cs
- webclient.cs
- XmlDataSourceNodeDescriptor.cs
- CssStyleCollection.cs
- InitializerFacet.cs
- EntityModelBuildProvider.cs
- HebrewCalendar.cs
- DispatcherSynchronizationContext.cs
- EmptyStringExpandableObjectConverter.cs
- ConnectionStringSettingsCollection.cs
- FileRegion.cs
- FileDetails.cs
- DataGridViewColumn.cs
- RuntimeConfig.cs
- DocumentViewerConstants.cs
- CellNormalizer.cs