---
title: "Class FieldReader"
slug: "sitecore.layoutservice.client.response.model.fieldreader"
abstract: ""
---
# Class FieldReader

Implements reading of a Field as a specified type.

## Inheritance

System.Object

FieldReader

[JsonSerializedField](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.json.fields.jsonserializedfield.html)

[NewtonsoftFieldReader](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.newtonsoft.model.newtonsoftfieldreader.html)

[Field](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.response.model.field.html)

### Implements

[IFieldReader](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.response.model.ifieldreader.html)

#### **Namespace**: Sitecore.LayoutService.Client.Response.Model

##### **Assembly**: Sitecore.LayoutService.Client.Abstractions.dll

##### Syntax

```csharp
public abstract class FieldReader : Object, IFieldReader

```

### Constructors

#### FieldReader()

##### Declaration

```csharp
protected FieldReader()

```

### Methods

#### HandleRead(Type)

Returns an instance of the Field data as a specified type.

##### Declaration

```csharp
protected abstract object HandleRead(Type type)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Type | type | The type to read the field as. |

##### Returns

| Type | Description |
| --- | --- |
| System.Object | A new instance of the specified type. |

#### Read(Type)

Reads the current Field as the specified type. The type must implement [IField](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.response.model.ifield.html).

##### Declaration

```csharp
public virtual object Read(Type type)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Type | type | The type of field to be read. |

##### Returns

| Type | Description |
| --- | --- |
| System.Object | A new instance if successful. |

#### Read<TField>()

Reads the current Field as the specified type.

##### Declaration

```

public virtual TField Read<TField>()
    where TField : IField

```

##### Returns

| Type | Description |
| --- | --- |
| TField | A new instance of `TField`. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TField | The type of Field to be read. |

#### TryRead(Type, out IField)

Attempts to read the current Field as the specified type. The type must implement [IField](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.response.model.ifield.html).

##### Declaration

```csharp
public virtual bool TryRead(Type type, out IField field)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Type | type | The type of field to be read. |
| IField | field | The resulting field. |

##### Returns

| Type | Description |
| --- | --- |
| System.Boolean | True if the field could be read as the specified type, otherwise false. |

#### TryRead<TField>(out TField)

Attempts to read the current Field as the specified type.

##### Declaration

```

public virtual bool TryRead<TField>(out TField field)
    where TField : IField

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| TField | field | The resulting instance if successful. |

##### Returns

| Type | Description |
| --- | --- |
| System.Boolean | True if the field could be read as the specified type, otherwise false. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TField | The type of Field to be read. |

### Implements

[IFieldReader](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.layoutservice.client.response.model.ifieldreader.html)
