From 2a846febf6915aca2aebfc9d9f22439dce50f6d7 Mon Sep 17 00:00:00 2001 From: lindexi Date: Thu, 18 Jul 2024 16:56:18 +0800 Subject: [PATCH] Fix code format in how-to-implement-dependency-injection.md --- .../how-to-implement-dependency-injection.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/guides/implementation-guides/how-to-implement-dependency-injection.md b/docs/guides/implementation-guides/how-to-implement-dependency-injection.md index 164746773..a847c6b65 100644 --- a/docs/guides/implementation-guides/how-to-implement-dependency-injection.md +++ b/docs/guides/implementation-guides/how-to-implement-dependency-injection.md @@ -72,8 +72,10 @@ dotnet add package Microsoft.Extensions.DependencyInjection The following code is creating an extension method for `IServiceCollection` that will register services to our service collection and make them available for injection. ```csharp -public static class ServiceCollectionExtensions { - public static void AddCommonServices(this IServiceCollection collection) { +public static class ServiceCollectionExtensions +{ + public static void AddCommonServices(this IServiceCollection collection) + { collection.AddSingleton(); collection.AddTransient(); collection.AddTransient();