Class LambdaResolveResult
- Namespace
- ICSharpCode.Decompiler.CSharp.Resolver
- Assembly
- ICSharpCode.Decompiler.dll
Represents an anonymous method or lambda expression. Note: the lambda has no type. To retrieve the delegate type, look at the anonymous function conversion.
public abstract class LambdaResolveResult : ResolveResult
- Inheritance
-
LambdaResolveResult
- Inherited Members
- Extension Methods
Constructors
LambdaResolveResult()
protected LambdaResolveResult()
Properties
Body
Gets the resolve result for the lambda body. Returns a resolve result for 'void' for statement lambdas.
public abstract ResolveResult Body { get; }
Property Value
HasParameterList
Gets whether there is a parameter list. This property always returns true for C# 3.0-lambdas, but may return false for C# 2.0 anonymous methods.
public abstract bool HasParameterList { get; }
Property Value
IsAnonymousMethod
Gets whether this lambda is using the C# 2.0 anonymous method syntax.
public abstract bool IsAnonymousMethod { get; }
Property Value
IsAsync
Gets whether the lambda is async.
public abstract bool IsAsync { get; }
Property Value
IsImplicitlyTyped
Gets whether the lambda parameters are implicitly typed.
public abstract bool IsImplicitlyTyped { get; }
Property Value
Remarks
This property returns false for anonymous methods without parameter list.
Parameters
Gets the list of parameters.
public abstract IReadOnlyList<IParameter> Parameters { get; }
Property Value
ReturnType
Gets the return type of the lambda.
If the lambda is async, the return type includes
Task<T>
public abstract IType ReturnType { get; }
Property Value
Methods
GetChildResults()
public override IEnumerable<ResolveResult> GetChildResults()
Returns
GetInferredReturnType(IType[])
Gets the return type inferred when the parameter types are inferred to be parameterTypes
public abstract IType GetInferredReturnType(IType[] parameterTypes)
Parameters
parameterTypes
IType[]
Returns
Remarks
This method determines the return type inferred from the lambda body, which is used as part of C# type inference. Use the ReturnType property to retrieve the actual return type as determined by the target delegate type.
IsValid(IType[], IType, CSharpConversions)
Gets whether the lambda body is valid for the given parameter types and return type.
public abstract Conversion IsValid(IType[] parameterTypes, IType returnType, CSharpConversions conversions)
Parameters
parameterTypes
IType[]returnType
ITypeconversions
CSharpConversions
Returns
- Conversion
Produces a conversion with IsAnonymousFunctionConversion=
true
if the lambda is valid; otherwise returns None.