From 40205ecdab65e4298311d0175a5bad7e629fa150 Mon Sep 17 00:00:00 2001 From: RiRiSharp Date: Tue, 12 Aug 2025 00:12:44 +0200 Subject: [PATCH] Fix line number in example for injecting services --- .../docs/providing-input/inject-services-into-components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/site/docs/providing-input/inject-services-into-components.md b/docs/site/docs/providing-input/inject-services-into-components.md index 2ab9f32a9..e73c68efa 100644 --- a/docs/site/docs/providing-input/inject-services-into-components.md +++ b/docs/site/docs/providing-input/inject-services-into-components.md @@ -22,7 +22,7 @@ The following sections demonstrate how to do this. The examples we will cover wi Here is a test that registers the `IWeatherForecastService` in the `Services` collection, which is a requirement of the `` component listed above. -[!code-csharp[WeatherForecastsTest.cs](../../../samples/tests/xunit/WeatherForecastsTest.cs?start=17&end=25&highlight=2)] +[!code-csharp[WeatherForecastsTest.cs](../../../samples/tests/xunit/WeatherForecastsTest.cs?start=17&end=24&highlight=2)] The highlighted line shows how the `IWeatherForecastService` is registered in the test context's `Services` collection, which is just a standard [`IServiceCollection`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection), using the standard .NET Core dependency injection (DI) services method, [`AddSingleton`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.servicecollectionserviceextensions.addsingleton?view=dotnet-plat-ext-3.1#Microsoft_Extensions_DependencyInjection_ServiceCollectionServiceExtensions_AddSingleton__1_Microsoft_Extensions_DependencyInjection_IServiceCollection___0_).