docs: Improved DI documentation (#2407)
This commit is contained in:
13
docs/guides/dependency_injection/samples/collection.cs
Normal file
13
docs/guides/dependency_injection/samples/collection.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
static IServiceProvider CreateServices()
|
||||
{
|
||||
var config = new DiscordSocketConfig()
|
||||
{
|
||||
//...
|
||||
};
|
||||
|
||||
var collection = new ServiceCollection()
|
||||
.AddSingleton(config)
|
||||
.AddSingleton<DiscordSocketClient>();
|
||||
|
||||
return collection.BuildServiceProvider();
|
||||
}
|
||||
Reference in New Issue
Block a user