November Happy Hour will be moved to Thursday December 5th.

Class LinkItem

Class that is used to represent and work with a html link.

Inheritance
System.Object
LinkItem
Implements
System.ICloneable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.SpecializedProperties
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
public class LinkItem : ICloneable

Constructors

LinkItem()

Initializes a new instance of the LinkItem class.

Declaration
public LinkItem()

LinkItem(XmlNode)

Initializes a new instance of the LinkItem class.

Declaration
public LinkItem(XmlNode anchorNode)
Parameters
Type Name Description
System.Xml.XmlNode anchorNode

An xml node that represents an anchor.

Properties

Attributes

Gets the link attributes.

Declaration
public Dictionary<string, string> Attributes { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, System.String>

The link attributes.

Href

Gets or sets the href part of the link.

Declaration
public string Href { get; set; }
Property Value
Type Description
System.String

The href part of the link.

Langauge

Gets the language from the link item.

Declaration
[Obsolete("Use 'new UrlBuilder(linkItem.Href).QueryLanguage' to parse language query from a link item")]
public string Langauge { get; }
Property Value
Type Description
System.String

The language.

Remarks

In case no language is specified LanguageResolver is returned.

Language

Gets the language from the link item.

Declaration
[Obsolete("Use 'new UrlBuilder(linkItem.Href).QueryLanguage' to parse language query from a link item")]
public string Language { get; }
Property Value
Type Description
System.String

The language.

Remarks

In case no language is specified LanguageResolver is returned.

Target

Gets or sets the target part of the link.

Declaration
public string Target { get; set; }
Property Value
Type Description
System.String

The target part of the link.

Text

Gets or sets the text part of the link.

Declaration
public string Text { get; set; }
Property Value
Type Description
System.String

The text part of the link.

Title

Gets or sets the title part of the link.

Declaration
public string Title { get; set; }
Property Value
Type Description
System.String

The title part of the link.

UrlResolver

Gets or sets the service used to resolve links.

Declaration
public Injected<UrlResolver> UrlResolver { get; set; }
Property Value
Type Description
Injected<UrlResolver>

Methods

Clone()

Creates a new object that is a copy of the current instance.

Declaration
public object Clone()
Returns
Type Description
System.Object

A new object that is a copy of this instance.

GetMappedHref()

Tries to get a mapped representation (that is a link with an absolute path) of the Href property; otherwise returns the Href.

Declaration
public string GetMappedHref()
Returns
Type Description
System.String

A mapped representation of the link.

GetMappedHref(Boolean)

Tries to get a mapped representation of the Href property; otherwise returns the Href.

Declaration
[Obsolete("Use the overload of GetMappedHref without any parameters.", false)]
public string GetMappedHref(bool addPreferredLanguageIfEmpty)
Parameters
Type Name Description
System.Boolean addPreferredLanguageIfEmpty

If the preferred language should be added when no specific language code is present.

Returns
Type Description
System.String

A mapped representation of the link.

Creates an external representation of the link.

Declaration
public string ToMappedLink()
Returns
Type Description
System.String

An external representation of the link.

Creates an external representation of the link.

Declaration
[Obsolete("Use the overload of ToMappedLink without any parameters.", false)]
public string ToMappedLink(bool addPreferredLanguageIfEmpty)
Parameters
Type Name Description
System.Boolean addPreferredLanguageIfEmpty

If the preferred language should be added when no specific language code is present.

Returns
Type Description
System.String

An external representation of the link.

Creates an internal representation of the link.

Declaration
public string ToPermanentLink()
Returns
Type Description
System.String

An internal representation of the link.

Implements

System.ICloneable

Extension Methods