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
TypeMapentity
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
Remarks
All overrides MUST call this using
base(typeMap, false)
Exceptions
- InvalidOperationException
If
is true and the entity type already exists in the graphextendGraph
- InvalidOperationException
If
is true and the entity requires another entity that is missing from the graphextendGraph
- InvalidCastException
If
is false and the object is not of typeextendGraph
TEntity
- See Also
Fields
OrderedCollectionType
ActivityStreams type name for "OrderedCollection" types.
[PublicAPI]
public const string OrderedCollectionType = "OrderedCollection"
Field Value
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
- See Also
Entity
private ASOrderedCollectionEntity Entity { get; }
Property Value
First
In a paged Collection, indicates the furthest preceding page of items in the collection.
public Linkable<ASOrderedCollectionPage>? First { get; set; }
Property Value
- See Also
FirstPopulated
In a paged Collection, gets the first populated entity.
public Linkable<ASOrderedCollectionPage>? FirstPopulated { get; }
Property Value
HasItems
True if this collection instance contains items, false otherwise.
public bool HasItems { get; }
Property Value
IsPaged
True if this is a paged collection, false otherwise.
public bool IsPaged { get; }
Property Value
Items
Identifies the items contained in a collection. The items might be ordered or unordered.
public LinkableList<ASObject>? Items { get; set; }
Property Value
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
- 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
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
Returns
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
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
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.