# FileGrainStorage Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.persistence.filestorage.filegrainstorage/)

## ClearStateAsync(string, GrainId, IGrainState&lt;T&gt;) {#clearstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-ccac7c9c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.persistence.filestorage.filegrainstorage/methods/clearstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-ccac7c9c/)

[Source](https://github.com/dotnet/orleans/blob/1644940b035c7bdf215a4fd7135757c06bcfe9ec/src/Orleans.Runtime/Persistence/FileStorage/FileGrainStorage.cs#L34)

```csharp
public Task ClearStateAsync<T>(string stateName, GrainId grainId, IGrainState<T> grainState)
```

Delete / Clear data function for this storage instance.

### Parameters

- `stateName` (`string`): Name of the state for this grain
- `grainId` (`GrainId`): Grain ID
- `grainState` (`IGrainState<T>`): Copy of last-known state data object for this grain.

### Returns

Completion promise for the Delete operation on the specified grain.

## Participate(ISiloLifecycle) {#participate-orleans-runtime-isilolifecycle-c8b39ceb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.persistence.filestorage.filegrainstorage/methods/participate-orleans-runtime-isilolifecycle-c8b39ceb/)

[Source](https://github.com/dotnet/orleans/blob/1644940b035c7bdf215a4fd7135757c06bcfe9ec/src/Orleans.Runtime/Persistence/FileStorage/FileGrainStorage.cs#L146-L153)

```csharp
public void Participate(ISiloLifecycle lifecycle)
```

Adds the provided observer as a participant in the lifecycle.

### Parameters

- `lifecycle` (`ISiloLifecycle`): The observer.

## ReadStateAsync(string, GrainId, IGrainState&lt;T&gt;) {#readstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-5ea2225d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.persistence.filestorage.filegrainstorage/methods/readstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-5ea2225d/)

[Source](https://github.com/dotnet/orleans/blob/1644940b035c7bdf215a4fd7135757c06bcfe9ec/src/Orleans.Runtime/Persistence/FileStorage/FileGrainStorage.cs#L67)

```csharp
public Task ReadStateAsync<T>(string stateName, GrainId grainId, IGrainState<T> grainState)
```

Read data function for this storage instance.

### Parameters

- `stateName` (`string`): Name of the state for this grain
- `grainId` (`GrainId`): Grain ID
- `grainState` (`IGrainState<T>`): State data object to be populated for this grain.

### Returns

Completion promise for the Read operation on the specified grain.

## WriteStateAsync(string, GrainId, IGrainState&lt;T&gt;) {#writestateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-a34ae60a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.runtime/orleans.persistence.filestorage.filegrainstorage/methods/writestateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-a34ae60a/)

[Source](https://github.com/dotnet/orleans/blob/1644940b035c7bdf215a4fd7135757c06bcfe9ec/src/Orleans.Runtime/Persistence/FileStorage/FileGrainStorage.cs#L103)

```csharp
public Task WriteStateAsync<T>(string stateName, GrainId grainId, IGrainState<T> grainState)
```

Write data function for this storage instance.

### Parameters

- `stateName` (`string`): Name of the state for this grain
- `grainId` (`GrainId`): Grain ID
- `grainState` (`IGrainState<T>`): State data object to be written for this grain.

### Returns

Completion promise for the Write operation on the specified grain.
