Class EntityListExtensions
Helper extensions for lists of entities.
[PublicApi]
public static class EntityListExtensions
- Inheritance
-
objectEntityListExtensions
Remarks
Has been used internally since forever, made public in v21.
Methods
Contains(IEnumerable<IEntity>, int)
Check if an entity is available. Mainly used in special cases where published/unpublished are hidden/visible
public static bool Contains(this IEnumerable<IEntity> list, int id)
Parameters
listIEnumerable<IEntity>idint
Returns
First(IEnumerable<IEntity>, string)
Returns the first entity that matches the specified type name, or null if not found.
public static IEntity? First(this IEnumerable<IEntity> list, string typeName)
Parameters
listIEnumerable<IEntity>The collection of entities to search.
typeNamestringThe name of the type to match. This comparison is case-sensitive.
Returns
- IEntity
The first entity whose type matches the specified type name, or null if no matching entity is found.
GetAll(IEnumerable<IEntity>, string)
Extract all entities of a specific content type from a list.
public static IEnumerable<IEntity> GetAll(this IEnumerable<IEntity> list, string typeName)
Parameters
listIEnumerable<IEntity>typeNamestring
Returns
GetOne(IEnumerable<IEntity>, Guid)
get an entity based on the guid - or null if not found
public static IEntity? GetOne(this IEnumerable<IEntity> list, Guid guid)
Parameters
listIEnumerable<IEntity>guidGuid
Returns
GetOne(IEnumerable<IEntity>, int)
Get an entity with an entity-id - or null if not found
public static IEntity? GetOne(this IEnumerable<IEntity> list, int id)
Parameters
listIEnumerable<IEntity>idint