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
Linkable(ASLink)
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
HasLink
true if this Linkable has a link reference
public bool HasLink { get; }
Property Value
HasValue
true if this Linkable has a value object
public bool HasValue { get; }
Property Value
Link
The link reference, or null if this linkable has an object.
public ASLink? Link { get; }
Property Value
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
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
TryGetLink(out ASLink?)
public bool TryGetLink(out ASLink? link)
Parameters
link
ASLink
Returns
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
Operators
implicit operator Linkable<T>(ASLink)
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>
implicit operator ASLink?(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
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>