Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / QIL / QilName.cs / 1305376 / QilName.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Diagnostics; namespace System.Xml.Xsl.Qil { ////// View over a Qil name literal. /// ////// Don't construct QIL nodes directly; instead, use the internal class QilName : QilLiteral { private string local; private string uri; private string prefix; //----------------------------------------------- // Constructor //----------------------------------------------- ///QilFactory . ////// Construct a new node /// public QilName(QilNodeType nodeType, string local, string uri, string prefix) : base(nodeType, null) { LocalName = local; NamespaceUri = uri; Prefix = prefix; Value = this; } //----------------------------------------------- // QilName methods //----------------------------------------------- public string LocalName { get { return this.local; } set { this.local = value; } } public string NamespaceUri { get { return this.uri; } set { this.uri = value; } } public string Prefix { get { return this.prefix; } set { this.prefix = value; } } ////// Build the qualified name in the form prefix:local /// public string QualifiedName { get { if (this.prefix.Length == 0) { return this.local; } else { return this.prefix + ':' + this.local; } } } ////// Override GetHashCode() so that the QilName can be used as a key in the hashtable. /// ///Does not compare their prefixes (if any). public override int GetHashCode() { return this.local.GetHashCode(); } ////// Override Equals() so that the QilName can be used as a key in the hashtable. /// ///Does not compare their prefixes (if any). public override bool Equals(object other) { QilName name = other as QilName; if (name == null) return false; return this.local == name.local && this.uri == name.uri; } ////// Implement operator == to prevent exidental referential comarison /// ///Does not compare their prefixes (if any). public static bool operator ==(QilName a, QilName b) { if ((object)a == (object)b) { return true; } if ((object)a == null || (object)b == null) { return false; } return a.local == b.local && a.uri == b.uri; } ////// Implement operator != to prevent exidental referential comarison /// ///Does not compare their prefixes (if any). public static bool operator !=(QilName a, QilName b) { return !(a == b); } ////// Return the QilName in this format: "{namespace}prefix:local-name". /// If the namespace is empty, return the QilName in this truncated format: "local-name". /// If the prefix is empty, return the QilName in this truncated format: "{namespace}local-name". /// public override string ToString() { if (prefix.Length == 0) { if (uri.Length == 0) return local; return string.Concat("{", uri, "}", local); } return string.Concat("{", uri, "}", prefix, ":", local); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Diagnostics; namespace System.Xml.Xsl.Qil { ////// View over a Qil name literal. /// ////// Don't construct QIL nodes directly; instead, use the internal class QilName : QilLiteral { private string local; private string uri; private string prefix; //----------------------------------------------- // Constructor //----------------------------------------------- ///QilFactory . ////// Construct a new node /// public QilName(QilNodeType nodeType, string local, string uri, string prefix) : base(nodeType, null) { LocalName = local; NamespaceUri = uri; Prefix = prefix; Value = this; } //----------------------------------------------- // QilName methods //----------------------------------------------- public string LocalName { get { return this.local; } set { this.local = value; } } public string NamespaceUri { get { return this.uri; } set { this.uri = value; } } public string Prefix { get { return this.prefix; } set { this.prefix = value; } } ////// Build the qualified name in the form prefix:local /// public string QualifiedName { get { if (this.prefix.Length == 0) { return this.local; } else { return this.prefix + ':' + this.local; } } } ////// Override GetHashCode() so that the QilName can be used as a key in the hashtable. /// ///Does not compare their prefixes (if any). public override int GetHashCode() { return this.local.GetHashCode(); } ////// Override Equals() so that the QilName can be used as a key in the hashtable. /// ///Does not compare their prefixes (if any). public override bool Equals(object other) { QilName name = other as QilName; if (name == null) return false; return this.local == name.local && this.uri == name.uri; } ////// Implement operator == to prevent exidental referential comarison /// ///Does not compare their prefixes (if any). public static bool operator ==(QilName a, QilName b) { if ((object)a == (object)b) { return true; } if ((object)a == null || (object)b == null) { return false; } return a.local == b.local && a.uri == b.uri; } ////// Implement operator != to prevent exidental referential comarison /// ///Does not compare their prefixes (if any). public static bool operator !=(QilName a, QilName b) { return !(a == b); } ////// Return the QilName in this format: "{namespace}prefix:local-name". /// If the namespace is empty, return the QilName in this truncated format: "local-name". /// If the prefix is empty, return the QilName in this truncated format: "{namespace}local-name". /// public override string ToString() { if (prefix.Length == 0) { if (uri.Length == 0) return local; return string.Concat("{", uri, "}", local); } return string.Concat("{", uri, "}", prefix, ":", local); } } } // 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
- ObjectDataSourceWizardForm.cs
- TreeNodeCollectionEditorDialog.cs
- TreeNodeCollection.cs
- AdapterUtil.cs
- VirtualPathProvider.cs
- Options.cs
- SqlDataSourceStatusEventArgs.cs
- handlecollector.cs
- _LocalDataStoreMgr.cs
- DataSourceHelper.cs
- util.cs
- RouteTable.cs
- StylusPlugin.cs
- Visual3D.cs
- ViewLoader.cs
- DocumentViewer.cs
- CommonDialog.cs
- AlignmentXValidation.cs
- XmlILTrace.cs
- CollectionViewSource.cs
- ComponentSerializationService.cs
- OleDbReferenceCollection.cs
- RenderCapability.cs
- TraceUtils.cs
- FullTextLine.cs
- SuspendDesigner.cs
- RequestCachingSection.cs
- TypeDescriptor.cs
- AppDomain.cs
- AutoGeneratedFieldProperties.cs
- PenCursorManager.cs
- LambdaValue.cs
- ProviderMetadataCachedInformation.cs
- FormView.cs
- InputLanguageCollection.cs
- LinqDataSourceUpdateEventArgs.cs
- LinqDataSourceSelectEventArgs.cs
- LoginCancelEventArgs.cs
- XamlReader.cs
- UmAlQuraCalendar.cs
- SqlAliaser.cs
- ExpressionParser.cs
- MasterPageParser.cs
- ScriptingWebServicesSectionGroup.cs
- WebBrowserHelper.cs
- FormsAuthenticationTicket.cs
- ipaddressinformationcollection.cs
- HttpEncoderUtility.cs
- Int32Rect.cs
- ParameterCollection.cs
- PropertyInformation.cs
- Separator.cs
- StickyNote.cs
- MenuEventArgs.cs
- Menu.cs
- BuildProviderCollection.cs
- ObfuscationAttribute.cs
- DesignerActionGlyph.cs
- __TransparentProxy.cs
- ParamArrayAttribute.cs
- DbParameterCollection.cs
- ConnectionPoint.cs
- SystemIPv6InterfaceProperties.cs
- CodeDomDesignerLoader.cs
- SemanticTag.cs
- TextChangedEventArgs.cs
- SafeThreadHandle.cs
- VideoDrawing.cs
- OrthographicCamera.cs
- SystemBrushes.cs
- MetadataCacheItem.cs
- IgnoreSectionHandler.cs
- LinqToSqlWrapper.cs
- SvcMapFile.cs
- DbConnectionPoolGroupProviderInfo.cs
- TypeDependencyAttribute.cs
- DiscoveryClientBindingElement.cs
- ToolStripLocationCancelEventArgs.cs
- TextEditorDragDrop.cs
- QueryStringHandler.cs
- SqlXml.cs
- Message.cs
- SettingsPropertyWrongTypeException.cs
- DispatchOperationRuntime.cs
- LicFileLicenseProvider.cs
- HierarchicalDataSourceControl.cs
- BitmapEffectDrawing.cs
- XmlSchemaSimpleTypeList.cs
- TraceSource.cs
- SoapExtensionTypeElement.cs
- RightsManagementEncryptedStream.cs
- Application.cs
- ServerIdentity.cs
- EventLogEntryCollection.cs
- ReliabilityContractAttribute.cs
- DataColumnSelectionConverter.cs
- _CookieModule.cs
- ClientScriptManager.cs
- LinqDataView.cs
- AssemblyHash.cs