Class IEntityExtensions
Extensions for IEntity to provide additional functionality or utilities.
[PublicApi]
public static class IEntityExtensions
- Inheritance
-
objectIEntityExtensions
Remarks
Introduced in v20, moving methods which were previously in IEntity
to here, since they are better as extensions.
Methods
Get<TValue>(IEntity, string)
Get a value in the expected type from this entity.
public static TValue? Get<TValue>(this IEntity entity, string name)
Parameters
Returns
- TValue
Type Parameters
TValue
The type to try-convert the result to
Remarks
If you want to supply a fallback
it will automatically use the other version of this method
History
- Introduced as beta in 15.06, published in v17
- Moved from IEntity to here in v20, as it is more of an extension than a core method of IEntity
Get<TValue>(IEntity, string, NoParamOrder, TValue?, string?, string?[]?)
Get a value in the expected type from this entity - or a fallback value instead.
public static TValue? Get<TValue>(this IEntity entity, string name, NoParamOrder noParamOrder = default, TValue? fallback = default, string? language = null, string?[]? languages = null)
Parameters
entity
IEntityname
stringthe field/attribute name
noParamOrder
NoParamOrderfallback
TValuevalue to be returned if finding or conversion it didn't succeed
language
stringoptional language like
en-us
languages
string[]optional list of language IDs which can be a list which is checked in the order provided
Returns
- TValue
Type Parameters
TValue
The type to try-convert the result to
Remarks
History
- Introduced as beta in 15.06, published in v17
- Moved from IEntity to here in v20, as it is more of an extension than a core method of IEntity