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
- TemplateLookupAction.cs
- WindowsRebar.cs
- ComponentCache.cs
- ListInitExpression.cs
- DefaultValueTypeConverter.cs
- FixedSOMTableCell.cs
- ConstructorBuilder.cs
- ListViewPagedDataSource.cs
- SizeConverter.cs
- CodeDomLocalizationProvider.cs
- AlphaSortedEnumConverter.cs
- ServiceReference.cs
- WebEventTraceProvider.cs
- ParagraphResult.cs
- _HeaderInfo.cs
- FontUnit.cs
- SystemWebExtensionsSectionGroup.cs
- MimeObjectFactory.cs
- FunctionImportElement.cs
- AsymmetricKeyExchangeFormatter.cs
- GradientBrush.cs
- WebResponse.cs
- ComplexBindingPropertiesAttribute.cs
- ContentElement.cs
- Compiler.cs
- BooleanExpr.cs
- TextProperties.cs
- PropertyNames.cs
- StorageSetMapping.cs
- _SslState.cs
- SecurityKeyType.cs
- DragCompletedEventArgs.cs
- EncoderReplacementFallback.cs
- CodeBlockBuilder.cs
- SoapAttributeOverrides.cs
- XPathEmptyIterator.cs
- XmlSchemaImport.cs
- WindowsHyperlink.cs
- StickyNoteHelper.cs
- ToolStripItemBehavior.cs
- Constants.cs
- SqlGatherProducedAliases.cs
- FileDialogCustomPlace.cs
- DoubleKeyFrameCollection.cs
- ContractTypeNameCollection.cs
- XmlSerializer.cs
- FixedDocumentSequencePaginator.cs
- printdlgexmarshaler.cs
- ConfigurationStrings.cs
- KnowledgeBase.cs
- ServiceObjectContainer.cs
- SmtpException.cs
- HwndHostAutomationPeer.cs
- ServiceCredentials.cs
- SiteMembershipCondition.cs
- StickyNote.cs
- MatcherBuilder.cs
- HandlerWithFactory.cs
- Mouse.cs
- UserControl.cs
- MimeTypeMapper.cs
- OdbcConnectionString.cs
- ObjectFullSpanRewriter.cs
- PreDigestedSignedInfo.cs
- SoundPlayerAction.cs
- DictionaryEntry.cs
- PixelShader.cs
- DeferrableContent.cs
- StorageAssociationSetMapping.cs
- GacUtil.cs
- InputManager.cs
- FileSystemInfo.cs
- DtrList.cs
- EnlistmentTraceIdentifier.cs
- ConsoleTraceListener.cs
- ErrorWrapper.cs
- EntityDataSourceContainerNameItem.cs
- Range.cs
- DbConnectionStringCommon.cs
- ListItemsPage.cs
- SimpleTextLine.cs
- ImageFormatConverter.cs
- ContractMapping.cs
- SamlAttributeStatement.cs
- ScriptResourceInfo.cs
- AspNetSynchronizationContext.cs
- Camera.cs
- HttpCookie.cs
- Rule.cs
- ElementsClipboardData.cs
- UnauthorizedWebPart.cs
- Baml2006KnownTypes.cs
- PasswordBox.cs
- DispatchChannelSink.cs
- SqlTrackingService.cs
- WebGetAttribute.cs
- InfocardClientCredentials.cs
- COM2AboutBoxPropertyDescriptor.cs
- FeatureSupport.cs
- ParseHttpDate.cs