MVC2, .NET4/C#4 optional parameters and Controller constructors

Posted by devlife on Stack Overflow See other posts from Stack Overflow or by devlife
Published on 2010-03-11T03:07:15Z Indexed on 2010/03/11 17:19 UTC
Read the original article Hit count: 517

Filed under:
|
|
|

I am a big fan of optional parameters in C#4 but am having an issue with MVC when I use them in my controller constructors. For example, if I have a single constructor:

public TestController(sting a = "") { /* blah */ }

MVC has a fit saying that there are no parameterless constructors for TestController.

How can I get around this?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about controllers