You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

DontInjectAttribute.Overwrite.md 648 B

12345678910111213141516171819202122232425262728
  1. ---
  2. uid: Discord.Commands.DontInjectAttribute
  3. remarks: *content
  4. ---
  5. The attribute can be applied to a public settable property inside a
  6. @Discord.Commands.ModuleBase based class. By applying this attribute,
  7. the marked property will not be automatically injected of the
  8. dependency. See [Dependency Injection](xref:Guides.Commands.Intro#dependency-injection)
  9. to learn more.
  10. ---
  11. uid: Discord.Commands.DontInjectAttribute
  12. example: [*content]
  13. ---
  14. ```cs
  15. public class MyModule : ModuleBase<SocketCommandContext>
  16. {
  17. [DontInject]
  18. public MyService MyService { get; set; }
  19. public MyModule()
  20. {
  21. MyService = new MyService();
  22. }
  23. }
  24. ```