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
- DockingAttribute.cs
- updatecommandorderer.cs
- PixelFormat.cs
- PlatformNotSupportedException.cs
- StringStorage.cs
- MasterPageBuildProvider.cs
- OdbcConnection.cs
- ObjectQueryState.cs
- ColumnReorderedEventArgs.cs
- Pair.cs
- PageAsyncTaskManager.cs
- MethodCallConverter.cs
- OciEnlistContext.cs
- ApplicationDirectory.cs
- XPathException.cs
- ProfileSettingsCollection.cs
- ValidatorCollection.cs
- Hyperlink.cs
- MatchingStyle.cs
- MemoryPressure.cs
- BoolExpr.cs
- StringOutput.cs
- TableAdapterManagerHelper.cs
- AuthenticationModulesSection.cs
- RootBrowserWindow.cs
- DetailsViewRow.cs
- Console.cs
- FixedDSBuilder.cs
- WebPartConnectionsConfigureVerb.cs
- SafeCoTaskMem.cs
- CodeTypeMember.cs
- Repeater.cs
- BoundField.cs
- SHA384Managed.cs
- XPathNodeInfoAtom.cs
- QueryableDataSourceView.cs
- EventLogPermissionHolder.cs
- InsufficientMemoryException.cs
- FileAuthorizationModule.cs
- ValueTable.cs
- IndexerNameAttribute.cs
- ReadWriteControlDesigner.cs
- SaveCardRequest.cs
- ErrorWrapper.cs
- SmtpMail.cs
- SqlDuplicator.cs
- FtpCachePolicyElement.cs
- LinearGradientBrush.cs
- EntryWrittenEventArgs.cs
- SmtpAuthenticationManager.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- TextServicesContext.cs
- FlowLayoutPanel.cs
- PeerCollaborationPermission.cs
- UnmanagedHandle.cs
- AndCondition.cs
- CellPartitioner.cs
- SqlBuilder.cs
- LastQueryOperator.cs
- DataRecord.cs
- relpropertyhelper.cs
- Expression.cs
- Error.cs
- XmlDocumentFragment.cs
- DisposableCollectionWrapper.cs
- DataDesignUtil.cs
- TypeDescriptor.cs
- SafeArrayTypeMismatchException.cs
- X509Certificate2.cs
- SimpleWebHandlerParser.cs
- FamilyTypeface.cs
- XmlWriter.cs
- RecognizerStateChangedEventArgs.cs
- TransactionScope.cs
- EndpointConfigContainer.cs
- FlowSwitchDesigner.xaml.cs
- XmlChildEnumerator.cs
- DataGridViewDataErrorEventArgs.cs
- SettingsSection.cs
- WebPartDeleteVerb.cs
- LateBoundBitmapDecoder.cs
- VScrollProperties.cs
- PrintPreviewDialog.cs
- PartBasedPackageProperties.cs
- ToolStripContainer.cs
- NumericUpDown.cs
- XmlCustomFormatter.cs
- Faults.cs
- Main.cs
- ClientProxyGenerator.cs
- ActivityCodeDomSerializationManager.cs
- EventToken.cs
- followingquery.cs
- TextAutomationPeer.cs
- SqlDataSourceAdvancedOptionsForm.cs
- InternalTypeHelper.cs
- TextServicesCompartmentEventSink.cs
- Single.cs
- httpapplicationstate.cs
- OracleParameterCollection.cs