Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SelectionEditingBehavior.cs
- ObjectSecurityT.cs
- EventSourceCreationData.cs
- FixedPosition.cs
- ScaleTransform.cs
- FrameworkContentElement.cs
- RadioButton.cs
- MetadataArtifactLoaderCompositeFile.cs
- httpapplicationstate.cs
- CodeBinaryOperatorExpression.cs
- WebPermission.cs
- EntityParameterCollection.cs
- BufferModesCollection.cs
- CodeGroup.cs
- StreamWithDictionary.cs
- SchemaLookupTable.cs
- CompleteWizardStep.cs
- RoleManagerSection.cs
- DrawingContextDrawingContextWalker.cs
- SpellerError.cs
- HyperLinkColumn.cs
- PolygonHotSpot.cs
- CodeExpressionCollection.cs
- SQLMoney.cs
- XmlSequenceWriter.cs
- AndAlso.cs
- HMAC.cs
- BitmapSourceSafeMILHandle.cs
- ImageFormatConverter.cs
- TrustLevel.cs
- TabPanel.cs
- Separator.cs
- BamlVersionHeader.cs
- Vector3D.cs
- ConfigXmlComment.cs
- PagedDataSource.cs
- TextElementCollection.cs
- WeakHashtable.cs
- VirtualizedItemPattern.cs
- SecurityRuntime.cs
- DataServiceHostWrapper.cs
- WorkflowNamespace.cs
- codemethodreferenceexpression.cs
- DbMetaDataCollectionNames.cs
- DbConnectionInternal.cs
- SmiRequestExecutor.cs
- RequestCacheManager.cs
- ValueExpressions.cs
- NativeObjectSecurity.cs
- VariableQuery.cs
- HttpPostedFile.cs
- TypeElement.cs
- CleanUpVirtualizedItemEventArgs.cs
- SqlNodeAnnotations.cs
- ProfileInfo.cs
- NameScope.cs
- DrawingVisualDrawingContext.cs
- ViewLoader.cs
- CfgParser.cs
- TargetFrameworkUtil.cs
- TTSEngineTypes.cs
- SpellCheck.cs
- ConfigurationLockCollection.cs
- Item.cs
- MenuCommandService.cs
- TypeUtil.cs
- TriggerCollection.cs
- DesignTimeSiteMapProvider.cs
- XmlAttributeCollection.cs
- TextAction.cs
- GlobalEventManager.cs
- DockPatternIdentifiers.cs
- PermissionSetEnumerator.cs
- UpdatePanelTrigger.cs
- RelationshipEnd.cs
- DataException.cs
- StylusLogic.cs
- DataBindingExpressionBuilder.cs
- recordstatefactory.cs
- DataSourceXmlElementAttribute.cs
- DataGridPagingPage.cs
- SchemaEntity.cs
- FontFamilyConverter.cs
- SqlCrossApplyToCrossJoin.cs
- AsyncSerializedWorker.cs
- InternalSafeNativeMethods.cs
- CompiledXpathExpr.cs
- CodeDelegateCreateExpression.cs
- CheckBoxField.cs
- DES.cs
- ButtonChrome.cs
- DelegateTypeInfo.cs
- SizeAnimationBase.cs
- StateMachineAction.cs
- KeyGestureValueSerializer.cs
- Point3D.cs
- WindowsStatusBar.cs
- Accessible.cs
- StreamAsIStream.cs
- FormDocumentDesigner.cs