/// <summary> /// Get return type. /// </summary> /// <param name="declaration"> /// The declaration. /// </param> /// <returns> /// An IType for the return type. /// </returns> public static IType GetReturnType(this IMethodDeclaration declaration) { IMethodDeclarationNode methodDeclarationNode = declaration as IMethodDeclarationNode; if (methodDeclarationNode == null) { return(null); } ITypeUsageNode typeUsage = methodDeclarationNode.TypeUsage; if (typeUsage == null) { return(null); } return(CSharpTypeFactory.CreateType(typeUsage)); }
/// <summary> /// Swap generic declaration to built in type. /// </summary> /// <param name="node"> /// The node to process. /// </param> private static void SwapGenericDeclarationToBuiltInType(ITypeArgumentListNode node) { IPsiModule project = node.GetPsiModule(); IList <ITypeUsageNode> typeUsageNodes = node.TypeArgumentNodes; IList <IType> types = node.TypeArguments; using (WriteLockCookie.Create(true)) { for (int i = 0; i < typeUsageNodes.Count; i++) { if (!types[i].IsUnknown) { ITypeUsageNode newTypeUsageNode = CSharpElementFactory.GetInstance(project).CreateTypeUsageNode(types[i]); using (WriteLockCookie.Create(true)) { ModificationUtil.ReplaceChild(typeUsageNodes[i], newTypeUsageNode); } } } } }