Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / Serialization / NameTable.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DesignerProperties.cs
- StyleSelector.cs
- XmlDataImplementation.cs
- PagesSection.cs
- WindowsAltTab.cs
- TimeSpanConverter.cs
- CriticalHandle.cs
- BitmapEffectDrawingContent.cs
- EntityDataSourceColumn.cs
- WebPartRestoreVerb.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- LineGeometry.cs
- XmlUTF8TextWriter.cs
- TrackingAnnotationCollection.cs
- SessionEndingCancelEventArgs.cs
- CheckPair.cs
- TemplateEditingService.cs
- RepeatInfo.cs
- SqlCacheDependencyDatabaseCollection.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- ListSourceHelper.cs
- ItemsChangedEventArgs.cs
- XmlEntity.cs
- UpdatePanelTriggerCollection.cs
- OleDbCommand.cs
- RecordsAffectedEventArgs.cs
- ObjectNavigationPropertyMapping.cs
- OdbcConnectionOpen.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- StringValueConverter.cs
- AnnotationComponentManager.cs
- StandardCommands.cs
- PartialToken.cs
- SafeRegistryHandle.cs
- ListView.cs
- UserControlCodeDomTreeGenerator.cs
- RegexCaptureCollection.cs
- NameService.cs
- assertwrapper.cs
- DataGridViewRow.cs
- ChooseAction.cs
- ConstraintCollection.cs
- Stack.cs
- TextProviderWrapper.cs
- TaiwanLunisolarCalendar.cs
- Region.cs
- RemoveStoryboard.cs
- SocketInformation.cs
- BaseTransportHeaders.cs
- VerificationException.cs
- securestring.cs
- FlowLayout.cs
- MembershipSection.cs
- XmlQualifiedNameTest.cs
- ParameterElement.cs
- Encoder.cs
- ErrorStyle.cs
- ListViewSortEventArgs.cs
- PhysicalAddress.cs
- BinaryReader.cs
- ZipIOCentralDirectoryBlock.cs
- Clock.cs
- EmptyControlCollection.cs
- NumericUpDownAccelerationCollection.cs
- ObjectAssociationEndMapping.cs
- MetaDataInfo.cs
- RequestCache.cs
- SmtpClient.cs
- Empty.cs
- LinqDataSourceContextEventArgs.cs
- SingleSelectRootGridEntry.cs
- SyndicationFeedFormatter.cs
- StackSpiller.cs
- WindowsAltTab.cs
- Classification.cs
- EntityDataSource.cs
- RandomNumberGenerator.cs
- HttpCacheVary.cs
- MergeFailedEvent.cs
- CustomAttributeSerializer.cs
- BevelBitmapEffect.cs
- OleDbRowUpdatingEvent.cs
- WorkItem.cs
- DocumentXmlWriter.cs
- PageContentCollection.cs
- StringInfo.cs
- ContravarianceAdapter.cs
- Substitution.cs
- TextEditorTyping.cs
- ToolStripScrollButton.cs
- StreamGeometry.cs
- DrawingImage.cs
- PageAsyncTaskManager.cs
- XPathAncestorQuery.cs
- QuaternionValueSerializer.cs
- SelectionUIService.cs
- CodeConditionStatement.cs
- AssemblyAttributesGoHere.cs
- Blend.cs
- XmlBinaryReader.cs