Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

adding a dependency injection service in windows forms app

    public class MainForm: Form
    {

      // ..

       private readonly IMySomeThing _mySomething;

       public MainForm()
       {
        _mySomething =   (IMySomeThing)Program.ServiceProvider.GetService(typeof(IMySomeThing));
       }     

    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #adding #dependency #injection #service #windows #forms #app
ADD COMMENT
Topic
Name
9+8 =