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
- RTTypeWrapper.cs
- XPathNavigatorReader.cs
- PageHandlerFactory.cs
- smtpconnection.cs
- LinqDataSource.cs
- TextPatternIdentifiers.cs
- SqlClientWrapperSmiStream.cs
- IgnoreSection.cs
- ToolStripContentPanelRenderEventArgs.cs
- HttpClientChannel.cs
- BaseCollection.cs
- EmptyEnumerator.cs
- SQLBytesStorage.cs
- XPathSingletonIterator.cs
- ToolTip.cs
- MemberRelationshipService.cs
- CustomTypeDescriptor.cs
- SystemFonts.cs
- DirectoryObjectSecurity.cs
- RepeaterItem.cs
- SurrogateSelector.cs
- CompModSwitches.cs
- mil_commands.cs
- XmlDataSourceView.cs
- SignedInfo.cs
- XPathCompileException.cs
- DateTimeOffset.cs
- DynamicUpdateCommand.cs
- XmlSchemaComplexContent.cs
- EntityDataSourceReferenceGroup.cs
- CssClassPropertyAttribute.cs
- InputMethod.cs
- CommandField.cs
- AttachInfo.cs
- NestPullup.cs
- CoTaskMemSafeHandle.cs
- ThousandthOfEmRealPoints.cs
- StrongNameMembershipCondition.cs
- BooleanProjectedSlot.cs
- Expression.cs
- ParserHooks.cs
- ToolStripPanelRenderEventArgs.cs
- EpmSyndicationContentDeSerializer.cs
- SubMenuStyleCollection.cs
- LowerCaseStringConverter.cs
- GrammarBuilderRuleRef.cs
- AttachedAnnotation.cs
- StrongName.cs
- ListBox.cs
- TemplateNodeContextMenu.cs
- WebBrowserNavigatedEventHandler.cs
- DataBoundControlAdapter.cs
- ISAPIWorkerRequest.cs
- ArrayTypeMismatchException.cs
- ResourceReferenceExpression.cs
- UnsafeNativeMethods.cs
- FixedNode.cs
- RawStylusInputCustomData.cs
- StringSorter.cs
- VisualBrush.cs
- CryptoApi.cs
- MasterPageParser.cs
- TransformationRules.cs
- ValidationError.cs
- ClientConfigurationSystem.cs
- HttpException.cs
- PackageRelationshipCollection.cs
- __FastResourceComparer.cs
- TabletDeviceInfo.cs
- LinearGradientBrush.cs
- OuterGlowBitmapEffect.cs
- ExtensionDataReader.cs
- ResolveNameEventArgs.cs
- Style.cs
- SiteMapPathDesigner.cs
- UnsafeNativeMethods.cs
- CacheEntry.cs
- RepeaterItemEventArgs.cs
- XPathParser.cs
- CodeTryCatchFinallyStatement.cs
- PrivateFontCollection.cs
- PersonalizationStateInfo.cs
- WebPartZoneBase.cs
- ExpandCollapsePattern.cs
- AuthenticationServiceManager.cs
- PersonalizationStateQuery.cs
- GroupItem.cs
- LocalizabilityAttribute.cs
- ApplicationServiceManager.cs
- TypeLibConverter.cs
- TypeDescriptor.cs
- OrderByQueryOptionExpression.cs
- ListControl.cs
- StickyNoteAnnotations.cs
- pingexception.cs
- EventLogPermissionAttribute.cs
- CallbackException.cs
- ReverseInheritProperty.cs
- FloaterBaseParagraph.cs
- PtsHelper.cs