Skip to content

Instantly share code, notes, and snippets.

@yngvebn
Created October 15, 2013 12:00
Show Gist options
  • Save yngvebn/6990480 to your computer and use it in GitHub Desktop.
Save yngvebn/6990480 to your computer and use it in GitHub Desktop.
private IEnumerable<INamedTypeSymbol> FindMessageHandlersFor(INamedTypeSymbol message, IEnumerable<INamedTypeSymbol> messageHandlers)
{
foreach (INamedTypeSymbol handler in messageHandlers)
{
foreach(var iface in handler.AllInterfaces)
{
foreach(var typeArgument in iface.TypeArguments)
{
if (typeArgument.Equals(message))
{
yield return handler;
break;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment