# Grain.DelayDeactivation(TimeSpan)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.grain/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.grain/methods/)

[Source](https://github.com/dotnet/orleans/blob/b7a9e3e1c9c54b3cec3a467c5734bf7744541bcf/src/Orleans.Core.Abstractions/Core/Grain.cs#L145-L149)

```csharp
protected void DelayDeactivation(TimeSpan timeSpan)
```

Delay Deactivation of this activation at least for the specified time duration. 

A positive `timeSpan` value means “prevent GC of this activation for that time span”.

A `System.TimeSpan.Zero` value means “cancel the previous setting of the [Grain](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.grain/) call and make this activation behave based on the regular Activation Garbage Collection settings”.

A `System.Threading.Timeout.InfiniteTimeSpan` value means “delay deactivation indefinitely”.

[Grain](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.grain/) would undo / override any current “keep alive” setting, making this grain immediately available for deactivation.

### Parameters

- `timeSpan` (`TimeSpan`)
