Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
4d764e615This file is pinned to the selected release. Download the original to open it in your design tool.
using ICSharpCode.Decompiler.TypeSystem;
using System.Linq;
namespace ICSharpCode.Decompiler.CSharp.Syntax;
public static class InvocationExpressionExtensions
{
public static string GetTargetMemberFullName(this InvocationExpression expression) =>
expression.GetReferencedMemberFullName();
/// <summary>
/// <para>Checks whether the invocation is a Task.Factory.StartNew call like either of the following.</para>
/// <list type="bullet">
/// <item>
/// <description>
/// <c>Task.Factory.StartNew(<>c__DisplayClass4_.<>9__0 ?? (<>c__DisplayClass4_.<>9__0 =
/// <>c__DisplayClass4_.<NameOfTaskStartingMethod>b__0), inputArgument);</c>
/// </description>
/// </item>
/// <item>
/// <description>
/// <c>Task.Factory.StartNew((Func<object, OutputType>)this.<NameOfTaskStartingMethod>b__6_0,
/// (object)inputArgument);</c>
/// </description>
/// </item>
/// </list>
/// </summary>
public static bool IsTaskStart(this InvocationExpression expression) =>
expression.Target.Is<MemberReferenceExpression>(memberReference => memberReference.IsTaskStartNew()) &&
(expression.Arguments.First().Is<BinaryOperatorExpression>(binary => binary.GetActualType().IsFunc()) ||
expression.Arguments.First().Is<CastExpression>(binary => binary.GetActualType().IsFunc()));
}