Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TextElementCollectionHelper.cs
- Msec.cs
- CollectionTypeElement.cs
- DataObjectAttribute.cs
- Registry.cs
- CryptoSession.cs
- MessageBox.cs
- RuntimeWrappedException.cs
- ServerIdentity.cs
- ParallelActivityDesigner.cs
- Point3D.cs
- XPathDocumentBuilder.cs
- BitmapEffectDrawing.cs
- EmbeddedMailObjectsCollection.cs
- Assembly.cs
- PrintPreviewControl.cs
- Scripts.cs
- LostFocusEventManager.cs
- DataGridViewRowEventArgs.cs
- RefExpr.cs
- WebPartVerb.cs
- MissingManifestResourceException.cs
- AdRotator.cs
- TrackingMemoryStream.cs
- BooleanAnimationUsingKeyFrames.cs
- AssemblyUtil.cs
- FontUnit.cs
- InArgumentConverter.cs
- AppLevelCompilationSectionCache.cs
- AsymmetricKeyExchangeDeformatter.cs
- ToolStripDropDownItemDesigner.cs
- MdiWindowListStrip.cs
- TableChangeProcessor.cs
- XmlSchemaImport.cs
- ConnectionStringsExpressionEditor.cs
- AnnouncementEventArgs.cs
- XPathArrayIterator.cs
- ChannelSinkStacks.cs
- SqlDataSourceWizardForm.cs
- ScrollBar.cs
- ExpressionBindings.cs
- GenericXmlSecurityToken.cs
- HostnameComparisonMode.cs
- Ref.cs
- InputLangChangeEvent.cs
- CheckBox.cs
- assertwrapper.cs
- ConfigDefinitionUpdates.cs
- GACMembershipCondition.cs
- ObjectSelectorEditor.cs
- StrokeNode.cs
- InternalControlCollection.cs
- RootBrowserWindow.cs
- PropertyPathWorker.cs
- RuntimeConfig.cs
- AuthenticationException.cs
- TypeUtil.cs
- DomainConstraint.cs
- BulletedListEventArgs.cs
- PerfCounterSection.cs
- TripleDESCryptoServiceProvider.cs
- FontWeightConverter.cs
- KeyGestureConverter.cs
- CachedBitmap.cs
- EventLogHandle.cs
- DataGridRowAutomationPeer.cs
- PerfService.cs
- GeneralTransform.cs
- _TLSstream.cs
- FormClosedEvent.cs
- OutputCacheSettings.cs
- Soap.cs
- InterleavedZipPartStream.cs
- AdCreatedEventArgs.cs
- AnchorEditor.cs
- RepeaterDesigner.cs
- Transform3DGroup.cs
- IdlingCommunicationPool.cs
- Geometry.cs
- ControlParameter.cs
- Flowchart.cs
- MemoryPressure.cs
- InternalBufferOverflowException.cs
- filewebresponse.cs
- TypeViewSchema.cs
- RowToParametersTransformer.cs
- xmlglyphRunInfo.cs
- _AuthenticationState.cs
- WebCodeGenerator.cs
- ListParagraph.cs
- Matrix3DStack.cs
- EntityDataSourceState.cs
- Crc32.cs
- WrappedIUnknown.cs
- TableStyle.cs
- CornerRadius.cs
- AssemblyAttributesGoHere.cs
- Header.cs
- MediaPlayer.cs
- HttpCacheVary.cs