Skip to content

Instantly share code, notes, and snippets.

@kkozmic
Created March 10, 2010 19:04
Show Gist options
  • Save kkozmic/328219 to your computer and use it in GitHub Desktop.
Save kkozmic/328219 to your computer and use it in GitHub Desktop.
if (ComponentType.IsGenericType)// we support generic collections only
{
// TypeUtil.GetAllInterfaces resturns flat collection of all interfaces, regardless of level
foreach (var @interface in TypeUtil.GetAllInterfaces(ComponentType))
{
if(@interface.GetGenericTypeDefinition()==typeof(IEnumerable<>))
{
return @interface.GetGenericArguments().Single();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment