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
- WmlLiteralTextAdapter.cs
- CodeObject.cs
- HttpCacheVaryByContentEncodings.cs
- MSAAEventDispatcher.cs
- GestureRecognizer.cs
- SoapIncludeAttribute.cs
- DataGridRelationshipRow.cs
- EntityModelSchemaGenerator.cs
- TimelineCollection.cs
- DbgCompiler.cs
- MDIWindowDialog.cs
- XhtmlBasicLabelAdapter.cs
- BaseDataList.cs
- DataGridViewComboBoxColumnDesigner.cs
- FormView.cs
- streamingZipPartStream.cs
- Run.cs
- DesignerSerializationOptionsAttribute.cs
- IndentedWriter.cs
- TreeView.cs
- ClientConvert.cs
- DefaultShape.cs
- CountAggregationOperator.cs
- Internal.cs
- PopupEventArgs.cs
- CodeDefaultValueExpression.cs
- DetailsViewUpdatedEventArgs.cs
- MailBnfHelper.cs
- StylusPoint.cs
- WebBrowsableAttribute.cs
- WhiteSpaceTrimStringConverter.cs
- DictionarySectionHandler.cs
- SourceInterpreter.cs
- DocComment.cs
- CommandLibraryHelper.cs
- CheckedPointers.cs
- CommonDialog.cs
- CreateCardRequest.cs
- ObjectDisposedException.cs
- StorageEntityTypeMapping.cs
- MemberHolder.cs
- XPathNodeList.cs
- MailHeaderInfo.cs
- ReadWriteSpinLock.cs
- CodeGenerator.cs
- ScriptResourceInfo.cs
- SpeechRecognitionEngine.cs
- Fonts.cs
- ThicknessAnimationUsingKeyFrames.cs
- EditorAttributeInfo.cs
- AlphaSortedEnumConverter.cs
- CreateInstanceBinder.cs
- followingquery.cs
- MouseEvent.cs
- EditBehavior.cs
- FormViewUpdateEventArgs.cs
- DataBoundControlParameterTarget.cs
- PrintPreviewControl.cs
- SqlConnectionFactory.cs
- NameValueCollection.cs
- RuntimeArgumentHandle.cs
- ChangeNode.cs
- TransformerConfigurationWizardBase.cs
- DataGridViewButtonColumn.cs
- BitmapEffect.cs
- SpeechRecognitionEngine.cs
- QuadraticBezierSegment.cs
- Ppl.cs
- BufferedReadStream.cs
- RuntimeHandles.cs
- CookieHandler.cs
- MediaElementAutomationPeer.cs
- DesignerCategoryAttribute.cs
- LogArchiveSnapshot.cs
- PropertyTab.cs
- ResourceSetExpression.cs
- KeyManager.cs
- TreeViewImageKeyConverter.cs
- _DisconnectOverlappedAsyncResult.cs
- HttpValueCollection.cs
- ProgressiveCrcCalculatingStream.cs
- ReadingWritingEntityEventArgs.cs
- PtsContext.cs
- TextTreeObjectNode.cs
- WsatConfiguration.cs
- WebCategoryAttribute.cs
- WithParamAction.cs
- BitmapEffectrendercontext.cs
- XmlElementAttributes.cs
- WpfXamlLoader.cs
- NotFiniteNumberException.cs
- LabelLiteral.cs
- TeredoHelper.cs
- SiblingIterators.cs
- SHA256Managed.cs
- TemplateBaseAction.cs
- TimeSpan.cs
- Util.cs
- DataGridViewCheckBoxColumn.cs
- LookupBindingPropertiesAttribute.cs