Search code examples
webformsinversion-of-controlsimple-injector

Parameter cannot be resolved C#


I'm working on setting up simple injector on a legacy application we have in ASP.NET Webforms in C#.

I'm VERY close to having everything done when I've hit an odd issue I've yet to be able to resolve...

private static object GetInstance(Type type)
    {
        return container.GetInstance<type>();
    }

This is part of the code that allows me to use constructor injection in webforms. Makes sense right? well this doesn't build as type cannot be resolved in the return statement. once that is fixed I believe everything is wired up properly.

I've tried everything I can come up with and the above is a copy paste. I even went so far as clean solution, reboots, etc just because it didn't make any sense to me...

Any ideas?


Solution

  • The level of dumb I feel holds no bounds atm.

    changing GetInstance<type>(); to GetInstance(type); fixed it face palm