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
- ContainerControl.cs
- InteropAutomationProvider.cs
- SQLGuidStorage.cs
- SettingsBindableAttribute.cs
- PasswordPropertyTextAttribute.cs
- ObjectMemberMapping.cs
- SplashScreen.cs
- TextDocumentView.cs
- DoubleCollection.cs
- MouseGesture.cs
- FullTextLine.cs
- HtmlGenericControl.cs
- X509ChainElement.cs
- TraceEventCache.cs
- CharacterBufferReference.cs
- MaterialGroup.cs
- TemplatePagerField.cs
- OleDragDropHandler.cs
- SafeRightsManagementPubHandle.cs
- exports.cs
- CodeGenerator.cs
- AssertSection.cs
- AccessDataSourceView.cs
- NativeMethods.cs
- StorageTypeMapping.cs
- TextSelection.cs
- SHA384Managed.cs
- WpfWebRequestHelper.cs
- PreviewPageInfo.cs
- DataGridDetailsPresenterAutomationPeer.cs
- PassportPrincipal.cs
- JsonDeserializer.cs
- Metadata.cs
- WebHttpBindingElement.cs
- ImageListStreamer.cs
- ExpressionParser.cs
- WizardStepBase.cs
- Rect3DConverter.cs
- EntityChangedParams.cs
- SvcFileManager.cs
- ImageCodecInfo.cs
- LinkButton.cs
- PrinterUnitConvert.cs
- _SpnDictionary.cs
- MenuStrip.cs
- ValidationError.cs
- DrawingDrawingContext.cs
- DesignerAutoFormatStyle.cs
- TraceUtility.cs
- OperatingSystem.cs
- TrustLevelCollection.cs
- DataGridParentRows.cs
- DataColumnPropertyDescriptor.cs
- DynamicPhysicalDiscoSearcher.cs
- AnchorEditor.cs
- ComContractElement.cs
- BitmapEffect.cs
- IndexedGlyphRun.cs
- Axis.cs
- Enum.cs
- CommonObjectSecurity.cs
- ClientApiGenerator.cs
- SmtpDigestAuthenticationModule.cs
- ParserStreamGeometryContext.cs
- MeshGeometry3D.cs
- AuthenticationServiceManager.cs
- SqlCharStream.cs
- URIFormatException.cs
- ListControl.cs
- Tile.cs
- TryCatch.cs
- Math.cs
- DataControlReferenceCollection.cs
- ProfileEventArgs.cs
- XslException.cs
- XmlTextEncoder.cs
- EdmValidator.cs
- Cursor.cs
- PointF.cs
- ClientBuildManager.cs
- SemaphoreFullException.cs
- GenericTextProperties.cs
- SqlClientWrapperSmiStreamChars.cs
- DbConnectionFactory.cs
- BindingGroup.cs
- TemplateParser.cs
- XmlTextWriter.cs
- SecurityElement.cs
- DataTableNewRowEvent.cs
- AutoSizeComboBox.cs
- QuaternionRotation3D.cs
- XmlName.cs
- InstanceStoreQueryResult.cs
- MatchingStyle.cs
- AutomationPropertyInfo.cs
- NativeWindow.cs
- BitmapEffectvisualstate.cs
- DataGridTablesFactory.cs
- X509Certificate2.cs
- ByeOperation11AsyncResult.cs