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
- InternalConfigEventArgs.cs
- GeneralTransform2DTo3D.cs
- WebServiceClientProxyGenerator.cs
- CopyOnWriteList.cs
- TextRunCache.cs
- RawTextInputReport.cs
- FontStyleConverter.cs
- FixedSOMTableRow.cs
- PassportPrincipal.cs
- DateTimeValueSerializerContext.cs
- hwndwrapper.cs
- TypeReference.cs
- SymmetricKeyWrap.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- CombinedGeometry.cs
- MaskPropertyEditor.cs
- ProxyAttribute.cs
- PageAsyncTask.cs
- DependencyPropertyHelper.cs
- XmlArrayItemAttributes.cs
- ContainerFilterService.cs
- GZipDecoder.cs
- ImageListStreamer.cs
- FieldAccessException.cs
- Site.cs
- ToolStripMenuItemCodeDomSerializer.cs
- OdbcRowUpdatingEvent.cs
- CodeMethodMap.cs
- ValuePattern.cs
- DataGridViewCellConverter.cs
- SvcFileManager.cs
- SetterBase.cs
- PathFigureCollection.cs
- MouseButtonEventArgs.cs
- RuntimeIdentifierPropertyAttribute.cs
- Options.cs
- BackStopAuthenticationModule.cs
- ButtonStandardAdapter.cs
- CodeTypeDelegate.cs
- DataGrid.cs
- ToolStripGrip.cs
- SQLCharsStorage.cs
- WebPartUtil.cs
- SupportsEventValidationAttribute.cs
- MailDefinition.cs
- _CommandStream.cs
- TrustLevel.cs
- WindowsTooltip.cs
- PassportAuthenticationModule.cs
- CollectionType.cs
- DependencySource.cs
- RootBrowserWindow.cs
- ParallelDesigner.cs
- StyleXamlTreeBuilder.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- TransformerInfoCollection.cs
- InvokeWebServiceDesigner.cs
- CngKey.cs
- RegexStringValidatorAttribute.cs
- Int16.cs
- BufferedGraphics.cs
- FileVersionInfo.cs
- OutputCacheSettings.cs
- EntityContainerEmitter.cs
- SplayTreeNode.cs
- DefaultSettingsSection.cs
- ConfigurationStrings.cs
- TableFieldsEditor.cs
- PerformanceCounterScope.cs
- TimeStampChecker.cs
- MouseEvent.cs
- RequestQueryParser.cs
- JumpList.cs
- DataGridViewCheckBoxColumn.cs
- TimeoutValidationAttribute.cs
- TreeViewAutomationPeer.cs
- ThemeInfoAttribute.cs
- SchemaObjectWriter.cs
- IDataContractSurrogate.cs
- TimeStampChecker.cs
- externdll.cs
- WeakReference.cs
- ControlPaint.cs
- HierarchicalDataTemplate.cs
- DoubleAnimationClockResource.cs
- HttpClientProtocol.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- XPathExpr.cs
- GroupBox.cs
- SqlComparer.cs
- WebPartTransformerCollection.cs
- XPathDocument.cs
- SafeCloseHandleCritical.cs
- XmlSchemaComplexContentRestriction.cs
- InputChannelBinder.cs
- MbpInfo.cs
- SystemIcmpV6Statistics.cs
- Quaternion.cs
- SrgsElementFactory.cs
- DropAnimation.xaml.cs