public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
{
IStructuralMatchResult match = Match(registrationRootElement);
if (match.Matched)
{
var argument = match.GetMatchedElement(ElementName) as ICSharpArgument;
if (argument == null)
{
yield break;
}
// match typeof() expressions
var typeOfExpression = argument.Value as ITypeofExpression;
if (typeOfExpression != null)
{
var typeElement = ((IDeclaredType)typeOfExpression.ArgumentType).GetTypeElement();
if (typeElement == null) // can happen if the typeof() expression is empty
{
yield break;
}
yield return new ComponentRegistration(registrationRootElement, typeElement);
}
}
}