Table of Contents

Class Linkable<T>

Namespace
ActivityPub.Types.Util
Assembly
ActivityPub.Types.dll

Synthetic wrapper for elements that can be included directly or referenced by a Link.

public sealed class Linkable<T> where T : ASType

Type Parameters

T

Type of element

Inheritance
Linkable<T>
Inherited Members

Constructors

Creates a Linkable from a reference link

public Linkable(ASLink link)

Parameters

link ASLink

Linkable(Linkable<T>)

Creates a linkable by cloning another linkable

public Linkable(Linkable<T> linkable)

Parameters

linkable Linkable<T>

Linkable(T)

Creates a linkable from a value object

public Linkable(T value)

Parameters

value T

Properties

true if this Linkable has a link reference

public bool HasLink { get; }

Property Value

bool

HasValue

true if this Linkable has a value object

public bool HasValue { get; }

Property Value

bool

The link reference, or null if this linkable has an object.

public ASLink? Link { get; }

Property Value

ASLink

Value

The value object, or this if this Linkable has a link reference

public T? Value { get; }

Property Value

T

Methods

Equals(Linkable<T>)

private bool Equals(Linkable<T> other)

Parameters

other Linkable<T>

Returns

bool

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

If this Linkable has a link, then returns true and assigns it to "link". Otherwise, returns false.

public bool TryGetLink(out ASLink? link)

Parameters

link ASLink

Returns

bool

TryGetValue(out T?)

If this Linkable has a value, then returns true and assigns it to "value". Otherwise, returns false.

public bool TryGetValue(out T? value)

Parameters

value T

Returns

bool

Operators

Creates a Linkable from a reference link

public static implicit operator Linkable<T>(ASLink link)

Parameters

link ASLink

Returns

Linkable<T>

implicit operator Linkable<T>(ASUri)

Creates a Linkable from a reference link

public static implicit operator Linkable<T>(ASUri link)

Parameters

link ASUri

Returns

Linkable<T>

Converts this Linkable<T> to its reference link, or null if it has a value object

public static implicit operator ASLink?(Linkable<T>? linkable)

Parameters

linkable Linkable<T>

Returns

ASLink

implicit operator T?(Linkable<T>?)

Converts this Linkable<T> to its value object, or null if it has a reference link

public static implicit operator T?(Linkable<T>? linkable)

Parameters

linkable Linkable<T>

Returns

T

implicit operator Linkable<T>(string)

Creates a Linkable from a reference link

public static implicit operator Linkable<T>(string link)

Parameters

link string

Returns

Linkable<T>

implicit operator Linkable<T>(Uri)

Creates a Linkable from a reference link

public static implicit operator Linkable<T>(Uri link)

Parameters

link Uri

Returns

Linkable<T>

implicit operator Linkable<T>(T)

Creates a linkable from a value object

public static implicit operator Linkable<T>(T value)

Parameters

value T

Returns

Linkable<T>