Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- DynamicPhysicalDiscoSearcher.cs
- FontFaceLayoutInfo.cs
- CacheSection.cs
- XPathChildIterator.cs
- SrgsOneOf.cs
- InteropExecutor.cs
- _OSSOCK.cs
- UserUseLicenseDictionaryLoader.cs
- BrushConverter.cs
- ScrollableControl.cs
- OdbcConnectionOpen.cs
- Comparer.cs
- AspNetSynchronizationContext.cs
- OrderedDictionary.cs
- DropDownButton.cs
- TreeViewEvent.cs
- Clause.cs
- PassportIdentity.cs
- StandardToolWindows.cs
- AsymmetricCryptoHandle.cs
- ZipFileInfoCollection.cs
- SiteMapNodeItem.cs
- OptimalTextSource.cs
- DataGridViewButtonColumn.cs
- TokenBasedSetEnumerator.cs
- WebHeaderCollection.cs
- DataGridViewSelectedCellCollection.cs
- TextOnlyOutput.cs
- UInt32.cs
- PeerTransportListenAddressValidatorAttribute.cs
- DataGridViewRowsRemovedEventArgs.cs
- securitycriticaldataformultiplegetandset.cs
- GC.cs
- Convert.cs
- IntranetCredentialPolicy.cs
- XmlnsDefinitionAttribute.cs
- TextEffect.cs
- PlanCompilerUtil.cs
- SystemColors.cs
- SqlRecordBuffer.cs
- UncommonField.cs
- OLEDB_Enum.cs
- PromptBuilder.cs
- ComboBox.cs
- InvalidDataException.cs
- SecurityTokenResolver.cs
- ADMembershipProvider.cs
- SignatureDescription.cs
- QuerySafeNavigator.cs
- EdgeModeValidation.cs
- DataGridViewCellParsingEventArgs.cs
- Vector3DAnimationBase.cs
- IteratorFilter.cs
- HttpContext.cs
- WorkflowValidationFailedException.cs
- Sql8ConformanceChecker.cs
- precedingsibling.cs
- SafeHandles.cs
- SoundPlayerAction.cs
- TextFormatter.cs
- MetadataItemCollectionFactory.cs
- ConfigurationSectionHelper.cs
- ViewManager.cs
- LoginView.cs
- RectangleHotSpot.cs
- KeyboardDevice.cs
- DataGridDesigner.cs
- ProcessThread.cs
- RequestCache.cs
- ADConnectionHelper.cs
- ButtonBase.cs
- StateBag.cs
- XPathNavigator.cs
- RowParagraph.cs
- ProviderConnectionPointCollection.cs
- ThrowHelper.cs
- DbProviderFactories.cs
- ScrollContentPresenter.cs
- TreeNodeMouseHoverEvent.cs
- GeometryDrawing.cs
- XmlSchemaAnnotated.cs
- DataGridPagerStyle.cs
- BigInt.cs
- InputMethodStateTypeInfo.cs
- XmlnsCompatibleWithAttribute.cs
- BinaryFormatterWriter.cs
- ProfileService.cs
- SchemaExporter.cs
- UserPersonalizationStateInfo.cs
- CalloutQueueItem.cs
- UndoManager.cs
- TraceContextRecord.cs
- MediaPlayer.cs
- QueryableDataSource.cs
- NativeMethods.cs
- FixedBufferAttribute.cs
- TabPage.cs
- MouseEvent.cs
- ObjectAnimationUsingKeyFrames.cs
- ZipIOExtraField.cs