Table of Contents

Class ASOrderedCollection

Namespace
ActivityPub.Types.AS.Collection
Assembly
ActivityPub.Types.dll

A Collection is a subtype of Object that represents ordered sets of Object or Link instances. May be paged or unpaged.

public class ASOrderedCollection : ASObject, IASModel<ASType, ASTypeEntity>, IASModel<ASType>, IASModel<ASObject, ASObjectEntity, ASType>, IASModel<ASObject, ASObjectEntity>, IASModel<ASObject>, IASModel<ASOrderedCollection, ASOrderedCollectionEntity, ASObject>, IASModel<ASOrderedCollection, ASOrderedCollectionEntity>, IASModel<ASOrderedCollection>, IEnumerable<Linkable<ASObject>>, IEnumerable
Inheritance
ASOrderedCollection
Implements
Derived
Inherited Members

Remarks

Refer to the Activity Streams 2.0 Core specification for a complete description of the Collection type.

Constructors

ASOrderedCollection()

Constructs a new instance and attaches it to a new, empty type graph.

public ASOrderedCollection()

ASOrderedCollection(ASType)

Constructs a new instance and extends an existing type graph from a provided model.

public ASOrderedCollection(ASType existingGraph)

Parameters

existingGraph ASType
See Also
Extend<TModel, TEntity>()

ASOrderedCollection(TypeMap, ASOrderedCollectionEntity?)

public ASOrderedCollection(TypeMap typeMap, ASOrderedCollectionEntity? entity)

Parameters

typeMap TypeMap
entity ASOrderedCollectionEntity

ASOrderedCollection(TypeMap, bool)

Constructs a new instance from an existing type graph. The existing graph is either extended or wrapped, depending on the value of

isExtending
public ASOrderedCollection(TypeMap typeMap, bool isExtending = true)

Parameters

typeMap TypeMap
isExtending bool

Remarks

All overrides MUST call this using

base(typeMap, false)

Exceptions

InvalidOperationException

If

extendGraph
is true and the entity type already exists in the graph
InvalidOperationException

If

extendGraph
is true and the entity requires another entity that is missing from the graph
InvalidCastException

If

extendGraph
is false and the object is not of type
TEntity
See Also
ProjectTo<TModel, TEntity>(bool)

Fields

OrderedCollectionType

ActivityStreams type name for "OrderedCollection" types.

[PublicAPI]
public const string OrderedCollectionType = "OrderedCollection"

Field Value

string

Properties

Current

In a paged Collection, indicates the page that contains the most recently updated member items.

public Linkable<ASOrderedCollectionPage>? Current { get; set; }

Property Value

Linkable<ASOrderedCollectionPage>
See Also

Entity

private ASOrderedCollectionEntity Entity { get; }

Property Value

ASOrderedCollectionEntity

First

In a paged Collection, indicates the furthest preceding page of items in the collection.

public Linkable<ASOrderedCollectionPage>? First { get; set; }

Property Value

Linkable<ASOrderedCollectionPage>
See Also

FirstPopulated

In a paged Collection, gets the first populated entity.

public Linkable<ASOrderedCollectionPage>? FirstPopulated { get; }

Property Value

Linkable<ASOrderedCollectionPage>

HasItems

True if this collection instance contains items, false otherwise.

public bool HasItems { get; }

Property Value

bool

IsPaged

True if this is a paged collection, false otherwise.

public bool IsPaged { get; }

Property Value

bool

Items

Identifies the items contained in a collection. The items might be ordered or unordered.

public LinkableList<ASObject>? Items { get; set; }

Property Value

LinkableList<ASObject>

Remarks

In ordered collection types, this will map to "orderedItems". Otherwise, it maps to "items". In a paged collection, this MAY be null

See Also

Last

In a paged Collection, indicates the furthest proceeding page of the collection.

public Linkable<ASOrderedCollectionPage>? Last { get; set; }

Property Value

Linkable<ASOrderedCollectionPage>
See Also

TotalItems

A non-negative integer specifying the total number of objects contained by the logical view of the collection. This number might not reflect the actual number of items serialized within the Collection object instance.

public int TotalItems { get; set; }

Property Value

int

Remarks

If not explicitly set, then this will default to the number of elements in Items. Setting this to any value will disable this logic. If neither is set, returns zero. This cannot be set to less than zero.

Methods

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<Linkable<ASObject>> GetEnumerator()

Returns

IEnumerator<Linkable<ASObject>>

An enumerator that can be used to iterate through the collection.

Operators

implicit operator ASOrderedCollection(List<ASObject>)

Converts a list of items into an ordered collection.

public static implicit operator ASOrderedCollection(List<ASObject> collection)

Parameters

collection List<ASObject>

Returns

ASOrderedCollection

Explicit Interface Implementations

IASModel<ASOrderedCollection>.ASTypeName

AS type name of this entity. For the full list of names in the object graph, use ASTypes.

static string IASModel<ASOrderedCollection>.ASTypeName { get; }

Returns

string

IASModel<ASOrderedCollection>.FromGraph(TypeMap)

Constructs an instance from this type from a pre-populated type graph. The provided TypeMap instance is guaranteed to include an instance of type EntityType.

static ASOrderedCollection IASModel<ASOrderedCollection>.FromGraph(TypeMap typeMap)

Parameters

typeMap TypeMap

Returns

ASOrderedCollection

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

IEnumerator IEnumerable.GetEnumerator()

Returns

IEnumerator

An IEnumerator object that can be used to iterate through the collection.

See Also