# Mixing in a C# interface which declares generic return types

**URL:** <https://www.ruby-forum.com/t/mixing-in-a-c-interface-which-declares-generic-return-types/218536>\
**Category:** IronRuby\
**Created:** [April 3, 2012, 5:24pm UTC](https://www.ruby-forum.com/t/mixing-in-a-c-interface-which-declares-generic-return-types/218536 "2012-04-03T17:24:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 3, 2012, 5:24pm UTC](https://www.ruby-forum.com/t/mixing-in-a-c-interface-which-declares-generic-return-types/218536/1 "2012-04-03T17:24:28Z")

</div>

Hi,  
I’m trying to mixin a C# interface into a ruby class, in order to use it  
as  
a mock.

My Ruby class :

class MockFoo  
include IFoo  
end

The C# interface :

public interface IFoo {  
T Get(); // this is OK  
IEnumerable GetAll(); // this fails  
}

When calling MockFoo.new, I get the following error :

```
  Method

```

System.Runtime.CompilerServices.CallSite`1[System.Func`4[System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,System.Object,System.Collections.Generic.IEnumerable`1[T]]] Create(System.Runtime.CompilerServices.CallSiteBinder) contains generic parameters (ArgumentError) System.Core:0:in`ValidateMethodInfo’  
System.Core:0:in `Call' System.Core:0:in`BindCore’

./features/registration/send\_verification\_email/send\_verification\_email\_steps.rb:18

features\registration\send\_verification\_email\send\_verification\_email.feature:9:in  
`When I register’

Its OK for methods like :

T Get()  
or  
T DoStuff(T bla)

But whenever I try to return a collection of T :

IEnumerable GetAll();

it fails.

Any ideas ?

Cheers,  
Ben

---

<div class="post-metadata">

**Author:** ![Ben\_Keeping](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/eb9ed0/32.png) [@Ben\_Keeping](https://www.ruby-forum.com/u/Ben_Keeping)\
**Post date:** [April 3, 2012, 11:20pm UTC](https://www.ruby-forum.com/t/mixing-in-a-c-interface-which-declares-generic-return-types/218536/2 "2012-04-03T23:20:13Z")

</div>

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)
