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
- ComponentRenameEvent.cs
- DataColumnMappingCollection.cs
- FixedStringLookup.cs
- ScrollViewerAutomationPeer.cs
- WebPartConnectionsConfigureVerb.cs
- TextDocumentView.cs
- GradientBrush.cs
- WSMessageEncoding.cs
- ReverseInheritProperty.cs
- FieldDescriptor.cs
- XmlRawWriter.cs
- ColumnClickEvent.cs
- baseaxisquery.cs
- XmlNodeList.cs
- ColorBlend.cs
- RemoteEndpointMessageProperty.cs
- EntityContainerEntitySet.cs
- GridViewHeaderRowPresenter.cs
- FocusManager.cs
- RTLAwareMessageBox.cs
- FullTextState.cs
- DynamicResourceExtensionConverter.cs
- SettingsAttributes.cs
- ContentOnlyMessage.cs
- SoapObjectInfo.cs
- HttpListenerPrefixCollection.cs
- UserMapPath.cs
- Polygon.cs
- BigIntegerStorage.cs
- FillBehavior.cs
- DbProviderServices.cs
- DataGridViewBindingCompleteEventArgs.cs
- OleDbCommand.cs
- TreeBuilder.cs
- WebContext.cs
- MenuItem.cs
- KeyTime.cs
- StandardCommandToolStripMenuItem.cs
- TextComposition.cs
- SimpleWorkerRequest.cs
- InProcStateClientManager.cs
- OdbcCommandBuilder.cs
- ImageIndexConverter.cs
- SqlConnection.cs
- KeyFrames.cs
- GridViewAutoFormat.cs
- BoundPropertyEntry.cs
- HtmlTableCellCollection.cs
- BaseDataBoundControl.cs
- SingletonInstanceContextProvider.cs
- ObjectMaterializedEventArgs.cs
- CellParaClient.cs
- QueryConverter.cs
- ApplicationDirectory.cs
- TransportListener.cs
- EnvelopeVersion.cs
- Matrix3D.cs
- FileNotFoundException.cs
- Privilege.cs
- DelegateBodyWriter.cs
- IEnumerable.cs
- XmlRootAttribute.cs
- UnSafeCharBuffer.cs
- ToolbarAUtomationPeer.cs
- DataGridrowEditEndingEventArgs.cs
- ContentElement.cs
- GPRECT.cs
- RSAPKCS1SignatureDeformatter.cs
- XmlReaderSettings.cs
- ObjectHelper.cs
- FusionWrap.cs
- TransformerTypeCollection.cs
- PathTooLongException.cs
- TableItemStyle.cs
- GiveFeedbackEventArgs.cs
- SuppressMergeCheckAttribute.cs
- DragCompletedEventArgs.cs
- LogLogRecordEnumerator.cs
- WebPartDisplayMode.cs
- DataServiceSaveChangesEventArgs.cs
- XDRSchema.cs
- PropertyEmitterBase.cs
- ApplicationSettingsBase.cs
- CriticalHandle.cs
- ZipArchive.cs
- Color.cs
- ProfileSettings.cs
- NativeMethodsOther.cs
- SortDescription.cs
- HtmlTernaryTree.cs
- SystemIPAddressInformation.cs
- ButtonDesigner.cs
- ListBoxChrome.cs
- ChannelCredentials.cs
- SEHException.cs
- GridViewDeleteEventArgs.cs
- TextBox.cs
- EventProviderWriter.cs
- GB18030Encoding.cs
- FilterElement.cs