# Code Review: GenericMethodsAndOverloads

**URL:** <https://www.ruby-forum.com/t/code-review-genericmethodsandoverloads/157544>\
**Category:** IronRuby\
**Created:** [January 13, 2009, 12:04am UTC](https://www.ruby-forum.com/t/code-review-genericmethodsandoverloads/157544 "2009-01-13T00:04:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [January 13, 2009, 12:04am UTC](https://www.ruby-forum.com/t/code-review-genericmethodsandoverloads/157544/1 "2009-01-13T00:04:12Z")

</div>

tfpt review “/shelveset:GenericMethodsAndOverloads;REDMOND\tomat”

```
Implements generic methods parameters binding and explicit overload 

```

selection. Adds methods Method/UnboundMethod#of and  
Method/UnboundMethod#overloads. Method#of takes a list of Ruby classes  
or CLR types and returns a Method instance that has bound generic  
parameters to these classes/types. Method#overloads takes a list of Ruby  
classes or CLR types and returns a Method instance that includes only  
those CLR methods grouped in the Method object whose parameters are of  
the given types.

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [January 14, 2009, 5:49am UTC](https://www.ruby-forum.com/t/code-review-genericmethodsandoverloads/157544/2 "2009-01-14T05:49:38Z")

</div>

Changes look good overall.

In RubyMethodGroupInfo.TryBindGenericParameters, an empty set of types  
will return all methods in MethodBases whether or not they’re generic.  
What’s the reason for this behavior?

There’s a chunk of code that was added to Utils.cs that’s indented too  
far.

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [January 14, 2009, 7:32am UTC](https://www.ruby-forum.com/t/code-review-genericmethodsandoverloads/157544/3 "2009-01-14T07:32:35Z")

</div>

TryBindGenericParameters should look like:

```
        foreach (var method in MethodBases) {
            if (method.IsGenericMethodDefinition) {
                if (typeArguments.Length == 

```

method.GetGenericArguments().Length) {  
Debug.Assert(!(method is ConstructorInfo));  
boundMethods.Add(((MethodInfo)method).MakeGenericMethod(typeArguments));  
}  
} else if (typeArguments.Length == 0) {  
boundMethods.Add(method);  
}  
}

Will include this fix in Indexers2 shelveset.

Tomas
