Question: Here's what I am trying to write:

```
public void Foo<T>(T parameter) {
  otherObject.Bar<T>(parameter);
}

```

The signature of the Bar() method is:

```
public void Bar<T>(T parameter) where T: class 

```

So I get a compile error because the T in Foo's signature doesn't have the same constraint. Unfortunately I can't write:

```
public void Foo<T>(T parameter) where T: class {
  otherObject.Bar<T>(parameter);
}

```

because Foo is implementing a method defined in an external interface. Question is:

Can I somehow transpose the T within the method Foo before calling Bar. (Note, I can be sure that T always will be a class - I just need to get past the compiler).

The only way I have found is using reflection but I wonder if there is a simpler trick I'm missing.

Answer: 
You can use the [`dynamic` keyword](http://msdn.microsoft.com/en-us/library/dd264741.aspx) like this:

```
public void Foo<T>(T parameter)
{
    dynamic p = parameter

    otherObject.Bar(p);
}

```

What's happening is that the resolution of the call to `otherObject.Bar` is being made at run-time, because one of the parameters has a type of `dynamic`. Assuming that `T` is a reference type, the resolution will succeed.

Granted, this ultimately uses reflection (as you've indicated), but the syntax is *probably* better than what you're using.

Of course, this will give you a run-time error in the event that `T` is *not* a class.
If you are the owner of otherObject.Bar, could you not just remove the class constraint? of that method. Or create a new similar method without the constraint?

casperOne. I am not sure your answer is correct, as you have the class constraint on your Foo method. The question stated that this was not possible as Foo was an implementation of an external interface. For instance, the code below does not work.

```
public void Foo<T>(T param)
    {
        dynamic xx = param;

        this.Bar(param);
    }

    private void Bar<T>(T param) where T: class {

    }

```

And shows up as an error.