Question: I have a GenericController which has the following methods: 

```
public class GenericGridController<T, TKey>:Controller
    where T : class
    where TKey : IComparable
{
    string GetFilterParam();
    string GetGridPartialName();
    List<T> GetGridModel(TKey param);
    List<T> GetGridModel(T entity);
    ActionResult GetGrid(TKey param);
    ActionResult Add(T entity);
    ActionResult Edit(T entity);
    ActionResult Delete(T entity);
}

```

When ever I need to create a grid, I am creating a new controller, inherited from the GenericGridController and I need to override the GetFilterParam and GetGridParialName, to provide the specific names. 

This is working just fine. Now I want to not override the 2 methods, and:

I was trying to do "something which I do not understand":
 - I made 2 string properties in the generic controller
 - I initialized them from the constructor, something like: 

```
    public string FilterParam { get; set; }
    public string GridPartialName { get; set; }

    public GenericGridController(string filterParamName, string partialName)
    {
        FilterParam = filterParamName;
        GridPartialName = partialName;
    }

```

then I create a new TestController, inherited from the GenerigGridController, and I saw that he ask to implement the missing contructor, something like this: 

```
public class TestController : GenericGridController<Candidat,int>
    {
        public TestController(string filterParamName, string partialName)
            : base(filterParamName, partialName)
        {

        }        
    }

```

I was expecting to do something like this: 

```
 public class TestController : GenericGridController<Candidat,int>("param","PartialView"){}

```

My question is: How to provide the 2 parameters need it in the GenericGridController constructor. 

Maybe is a stupid question, I am just trying to understand how this works.

Answer: 
You cannot have a parameter *value* as part of a class declaration.

Two solutions come to my mind:

1. Use properties with default values and overwrite in derived classes
`public string FilterParam { get; set; }
public string GridPartialName { get; set; }`

public GenericGridController()
{
 this.FilterParam = "defaultFilterParamValue";
 this.GridPartialName = "defaultGridPartialNameValue";
}

and in the derived class

```
public DerivedGridController()
{
    this.FilterParam = "foo";
    this.GridPartialName = "derived";
}

```

2. declare those properties as `abstract`

`public abstract string FilterParam { get; }
 public abstract string GridPartialName { get; }`
Using `abstract` forces every derived class to implement those properties returning a constant or computed value

```
public override string FilterParam { get { return "myFilterParam"; } }

```
I reckon you're looking for something like this:

```
public class TestController : GenericGridController<Candidat,int>
{
    public TestController()
        : base("param","PartialView")
    {

    }
}

```

Having defined a parameterless constructor, you can now create instances of TestController simply as `new TestController()`.

However, creating a whole another class only to hardcode different values for constructor parameters of a base class (or indeed override 2 getters to return some hardcoded value) is *questionable* to say the least.

> 
> I was expecting to do something like this:
> 
> 
> class TestController :
>  GenericGridController("param","PartialView"){}
> 
> 
> 

And this seems to show a lack of understanding on a deeper level. Constructor is invoked when creating an instance of a class, you cannot provide constructor parameters like this, in the declaration of the base class for `TestController`, as no instance is being created at this point.