Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Injector
Injector

Injector

TherionIM

|
624 installs
| (0) | Free
Injects selected methods into the containing class. You can choose to simply convert a method in an injected Action or Func or convert the method and initialize the new Action or Func from the constructor.
Download

Injects selected methods into the containing class. You can choose to simply convert a method in an injected Action or Func or convert the method and initialize the new Action or Func from the constructor. Use it when you need to implement the dependency injection pattern. 

Inject option:

C#
Edit|Remove
csharp
 class Test {     private void TestMethod()     {     }         }
 class Test  {      private void TestMethod()      {      }          }

refactors to:

C#
Edit|Remove
csharp
class Test{    private Action TestMethodInjected;    private void TestMethod()    {        TestMethodInjected();    }        }
class Test {     private Action TestMethodInjected;      private void TestMethod()     {         TestMethodInjected();     }         }
 

Inject and initialize option:

C#
Edit|Remove
csharp
class Test{    private string TestMethod(int i, char c, double d)    {    }        }
class Test {     private string TestMethod(int i, char c, double d)     {     }         }
 

refactors to:

C#
Edit|Remove
csharp
class Test{    private readonly Func<int, char, double, String> TestMethodInjected;    public Test(Func<int, char, double, String> TestMethodInjected)    {        this.TestMethodInjected = TestMethodInjected;    }    private string TestMethod(int i, char c, double d)    {        return TestMethodInjected(i, c, d);    }        }
class Test {     private readonly Func<int, char, double, String> TestMethodInjected;      public Test(Func<int, char, double, String> TestMethodInjected)     {         this.TestMethodInjected = TestMethodInjected;     }     private string TestMethod(int i, char c, double d)     {         return TestMethodInjected(i, c, d);     }         }
 
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft