# ServiceCollectionExtensions.TryAddFromExisting(IServiceCollection)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.configuration.internal.servicecollectionextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.configuration.internal.servicecollectionextensions/methods/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core/Configuration/ServiceCollectionExtensions.cs#L62-L66)

```csharp
public static void TryAddFromExisting<TService, TImplementation>(this IServiceCollection services)
```

Registers an existing registration of `TImplementation` as a provider of `TService` if there are no existing `TService` implementations.

### Parameters

- `services` (`IServiceCollection`): The service collection.
