AgentMulder.ReSharper.Domain.Utils.ContainerExtensions.IsContainerCall C# (CSharp) Method

IsContainerCall() public static method

public static IsContainerCall ( this node, string containerClrTypeName ) : bool
node this
containerClrTypeName string
return bool
        public static bool IsContainerCall(this ITreeNode node, string containerClrTypeName)
        {
            var invocationExpression = node as IInvocationExpression;
            if (invocationExpression == null)
            {
                return false;
            }

            var resolve = invocationExpression.InvocationExpressionReference.Resolve().Result;
            var method = resolve.DeclaredElement as IMethod;
            if (method == null)
            {
                return false;
            }
            ITypeElement containingType = method.GetContainingType();
            if (containingType == null)
            {
                return false;
            }

            IDeclaredType containerClrType = CreateTypeByClrName(node, containerClrTypeName);

            return containingType.IsDescendantOf(containerClrType.GetTypeElement());
        }