I would like to have a class that handles population of lists of data from a drop down that can take any type as I would rather have the external code looking like:

```
listProvider.For<AnEnumType>().And<AClass>.GetLists();

```

than

```
listProvider.ForEnum<AnEnumType>().ForClass<AClass>.GetLists();

```

Here is the example code

```
public class Foo
{
    public void DoSomething<T>
    {
        if(typeof(T).IsEnum)
        {
           //Do Something
        } else if (typeof(T).IsClass)
        {
           var bar = new Bar();

           //Problem How to call bar as type T must be a reference type?
           bar.GetData<T>()
        }     
    }
}

public class Bar
{
    public IProvideList<T> GetData() where T : class
    {
        //Do Something
    }
}

public interface IProvideList<T> T : class
{

}

```

At compile time the complier doesn't know that T is a class, but I know it will at runtime. I can call this with reflection:

```
bar.GetType().GetMethod("GetData").MakeGenericMethod(typeof(T));

```

however, I can't cast the result back to (IProvideList) when invoking the method because T must be a referenceType

Is there any way to get around this?