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
- RequestQueryProcessor.cs
- StringConverter.cs
- IpcChannelHelper.cs
- InstanceOwnerException.cs
- SmtpReplyReaderFactory.cs
- SectionInformation.cs
- InternalUserCancelledException.cs
- XmlSchemaProviderAttribute.cs
- EdgeProfileValidation.cs
- RequestQueryProcessor.cs
- ToolboxItemAttribute.cs
- AddressHeader.cs
- RectKeyFrameCollection.cs
- TextRangeSerialization.cs
- SqlDataSourceQueryConverter.cs
- LateBoundBitmapDecoder.cs
- BinaryExpression.cs
- LiteralLink.cs
- Control.cs
- SHA512Cng.cs
- PrintDialogException.cs
- Config.cs
- FormsAuthenticationCredentials.cs
- IsolatedStorageException.cs
- ISAPIApplicationHost.cs
- ADMembershipProvider.cs
- ColorContextHelper.cs
- VisualStyleInformation.cs
- ProcessHostFactoryHelper.cs
- XmlMapping.cs
- WebPageTraceListener.cs
- CopyOfAction.cs
- DataGridViewBand.cs
- EntitySqlException.cs
- ListBoxItemWrapperAutomationPeer.cs
- DrawingGroup.cs
- ScrollViewer.cs
- ListenerPerfCounters.cs
- DaylightTime.cs
- DataGridColumnDropSeparator.cs
- XPathBuilder.cs
- DispatcherProcessingDisabled.cs
- DataObjectPastingEventArgs.cs
- SHA256Cng.cs
- ReachVisualSerializerAsync.cs
- WebPartTransformer.cs
- DescriptionAttribute.cs
- FixedDocument.cs
- TextOutput.cs
- WCFBuildProvider.cs
- HtmlString.cs
- XmlQueryCardinality.cs
- BuiltInExpr.cs
- DirectoryRootQuery.cs
- CommandHelper.cs
- CqlLexerHelpers.cs
- TreeView.cs
- WindowsFormsHostAutomationPeer.cs
- Pool.cs
- StatusBarPanel.cs
- StateInitialization.cs
- DataGridHeaderBorder.cs
- HtmlControlPersistable.cs
- User.cs
- DataGridViewCheckBoxColumn.cs
- SharedPerformanceCounter.cs
- StrongTypingException.cs
- Marshal.cs
- MetadataItem.cs
- ProjectedSlot.cs
- WindowsStatusBar.cs
- EventHandlingScope.cs
- DBProviderConfigurationHandler.cs
- ProfileManager.cs
- Zone.cs
- GeneralTransform3DTo2DTo3D.cs
- InternalBufferOverflowException.cs
- StylusPlugInCollection.cs
- StringBuilder.cs
- AdornerHitTestResult.cs
- OracleTimeSpan.cs
- FontStyles.cs
- DetailsViewRow.cs
- UpdateManifestForBrowserApplication.cs
- CultureInfoConverter.cs
- XamlRtfConverter.cs
- EdmEntityTypeAttribute.cs
- ConfigXmlWhitespace.cs
- InternalSafeNativeMethods.cs
- ConfigXmlDocument.cs
- HostSecurityManager.cs
- IIS7WorkerRequest.cs
- TableStyle.cs
- IsolatedStoragePermission.cs
- ClientData.cs
- ValueCollectionParameterReader.cs
- ConfigurationHandlersInstallComponent.cs
- DataGridLinkButton.cs
- TdsValueSetter.cs
- BoundingRectTracker.cs