Discord.Net/docs/_overwrites/Commands/DontInjectAttribute.Overwrite.md

27 lines
596 B
Markdown
Raw Permalink Normal View History

2024-06-12 22:43:59 -07:00
---
uid: Discord.Commands.DontInjectAttribute
remarks: *content
---
The attribute can be applied to a public settable property inside a
@Discord.Commands.ModuleBase based class. By applying this attribute,
the marked property will not be automatically injected of the
dependency. See @Guides.Commands.DI to learn more.
---
uid: Discord.Commands.DontInjectAttribute
example: [*content]
---
```cs
public class MyModule : ModuleBase<SocketCommandContext>
{
[DontInject]
public MyService MyService { get; set; }
public MyModule()
{
MyService = new MyService();
}
}
```