Interface IFieldsReader
- Namespace
- Sitecore.AspNetCore.SDK.LayoutService.Client.Response.Model
- Assembly
- Sitecore.AspNetCore.SDK.LayoutService.Client.dll
Exposes a collection of IFieldReader.
public interface IFieldsReader
Properties
Fields
Gets or sets the Fields associated with this instance.
Dictionary<string, IFieldReader> Fields { get; set; }
Property Value
Methods
ReadField(Type, string)
Reads a field from the collection as the specified type.
object? ReadField(Type type, string name)
Parameters
Returns
- object
A new instance of the specified type.
ReadField<TField>(string)
Reads a field from the collection as the specified type.
TField? ReadField<TField>(string name) where TField : IField
Parameters
namestringThe name of the field to be read.
Returns
- TField
A new instance of
TField.
Type Parameters
TFieldThe type of object to return.
ReadFields(Type)
Reads the collection of fields as the specified type.
object? ReadFields(Type type)
Parameters
typeTypeThe type of object to return.
Returns
- object
A new instance of the specified type.
ReadFields<T>()
Reads the collection of fields as the specified type.
T? ReadFields<T>() where T : new()
Returns
- T
A new instance of
T.
Type Parameters
TThe type of object to return.
TryReadField(Type, string, out object?)
Attempts to read a field from the collection as the specified type.
bool TryReadField(Type type, string name, out object? instance)
Parameters
typeTypeThe type of object to return.
namestringThe name of the field to be read.
instanceobjectA new instance of
typeif successful.
Returns
- bool
True if successful, otherwise false.
TryReadField<TField>(string, out TField?)
Attempts to read a field from the collection as the specified type.
bool TryReadField<TField>(string name, out TField? instance) where TField : IField
Parameters
namestringThe name of the field to be read.
instanceTFieldThe resulting instance if successful.
Returns
- bool
True if successful, otherwise false.
Type Parameters
TFieldThe type of object to return.
TryReadFields(Type, out object?)
Attempts to read the collection of fields as the specified type.
bool TryReadFields(Type type, out object? instance)
Parameters
Returns
- bool
True if successful, otherwise false.
TryReadFields<T>(out T?)
Attempts to read the collection of fields as the specified type.
bool TryReadFields<T>(out T? instance) where T : new()
Parameters
instanceTThe resulting instance if successful.
Returns
- bool
True if successful, otherwise false.
Type Parameters
TThe type of object to return.