Table of Contents

Class Conversion

Namespace
ICSharpCode.Decompiler.Semantics
Assembly
ICSharpCode.Decompiler.dll

Holds information about a conversion between two types.

public abstract class Conversion : IEquatable<Conversion>
Inheritance
Conversion
Implements
Inherited Members

Constructors

Conversion()

protected Conversion()

Fields

BoxingConversion

public static readonly Conversion BoxingConversion

Field Value

Conversion

ExplicitDynamicConversion

public static readonly Conversion ExplicitDynamicConversion

Field Value

Conversion

ExplicitLiftedNumericConversion

public static readonly Conversion ExplicitLiftedNumericConversion

Field Value

Conversion

ExplicitNullableConversion

public static readonly Conversion ExplicitNullableConversion

Field Value

Conversion

ExplicitNumericConversion

public static readonly Conversion ExplicitNumericConversion

Field Value

Conversion

ExplicitPointerConversion

public static readonly Conversion ExplicitPointerConversion

Field Value

Conversion

ExplicitReferenceConversion

public static readonly Conversion ExplicitReferenceConversion

Field Value

Conversion

IdentityConversion

Identity conversion.

public static readonly Conversion IdentityConversion

Field Value

Conversion

ImplicitConstantExpressionConversion

The numeric conversion of a constant expression.

public static readonly Conversion ImplicitConstantExpressionConversion

Field Value

Conversion

ImplicitDynamicConversion

public static readonly Conversion ImplicitDynamicConversion

Field Value

Conversion

ImplicitInterpolatedStringConversion

C# 6 string interpolation expression implicitly being converted to IFormattable or FormattableString.

public static readonly Conversion ImplicitInterpolatedStringConversion

Field Value

Conversion

ImplicitLiftedNumericConversion

public static readonly Conversion ImplicitLiftedNumericConversion

Field Value

Conversion

ImplicitNullableConversion

public static readonly Conversion ImplicitNullableConversion

Field Value

Conversion

ImplicitNumericConversion

public static readonly Conversion ImplicitNumericConversion

Field Value

Conversion

ImplicitPointerConversion

public static readonly Conversion ImplicitPointerConversion

Field Value

Conversion

ImplicitReferenceConversion

public static readonly Conversion ImplicitReferenceConversion

Field Value

Conversion

None

Not a valid conversion.

public static readonly Conversion None

Field Value

Conversion

NullLiteralConversion

public static readonly Conversion NullLiteralConversion

Field Value

Conversion

ThrowExpressionConversion

C# 7 throw expression being converted to an arbitrary type.

public static readonly Conversion ThrowExpressionConversion

Field Value

Conversion

TryCast

C# 'as' cast.

public static readonly Conversion TryCast

Field Value

Conversion

UnboxingConversion

public static readonly Conversion UnboxingConversion

Field Value

Conversion

Properties

ConversionAfterUserDefinedOperator

The conversion that is applied to the result of the user-defined conversion operator.

public virtual Conversion ConversionAfterUserDefinedOperator { get; }

Property Value

Conversion

ConversionBeforeUserDefinedOperator

The conversion that is applied to the input before the user-defined conversion operator is invoked.

public virtual Conversion ConversionBeforeUserDefinedOperator { get; }

Property Value

Conversion

DelegateCapturesFirstArgument

For method-group conversions, gets whether the conversion captures the first argument.

For instance methods, this property always returns true for C# method-group conversions. For static methods, this property returns true for method-group conversions of an extension method performed on an instance (eg. Func<int> f = myEnumerable.Single).

public virtual bool DelegateCapturesFirstArgument { get; }

Property Value

bool

ElementConversions

For a tuple conversion, gets the individual tuple element conversions.

public virtual ImmutableArray<Conversion> ElementConversions { get; }

Property Value

ImmutableArray<Conversion>

IsAnonymousFunctionConversion

Gets whether this conversion is an anonymous function conversion.

public virtual bool IsAnonymousFunctionConversion { get; }

Property Value

bool

IsBoxingConversion

Gets whether this conversion is a boxing conversion.

public virtual bool IsBoxingConversion { get; }

Property Value

bool

IsConstantExpressionConversion

public virtual bool IsConstantExpressionConversion { get; }

Property Value

bool

IsDynamicConversion

Gets whether the conversion is dynamic.

public virtual bool IsDynamicConversion { get; }

Property Value

bool

IsEnumerationConversion

Gets whether the conversion is an enumeration conversion.

public virtual bool IsEnumerationConversion { get; }

Property Value

bool

IsExplicit

public virtual bool IsExplicit { get; }

Property Value

bool

IsIdentityConversion

public virtual bool IsIdentityConversion { get; }

Property Value

bool

IsImplicit

public virtual bool IsImplicit { get; }

Property Value

bool

IsInterpolatedStringConversion

Gets whether this is an interpolated string conversion to IFormattable or FormattableString.

public virtual bool IsInterpolatedStringConversion { get; }

Property Value

bool

IsLifted

Gets whether this conversion is a lifted version of another conversion.

public virtual bool IsLifted { get; }

Property Value

bool

IsMethodGroupConversion

Gets whether this conversion is a method group conversion.

public virtual bool IsMethodGroupConversion { get; }

Property Value

bool

IsNullLiteralConversion

public virtual bool IsNullLiteralConversion { get; }

Property Value

bool

IsNullableConversion

Gets whether the conversion is a nullable conversion (conversion between a nullable type and the regular type).

public virtual bool IsNullableConversion { get; }

Property Value

bool

IsNumericConversion

public virtual bool IsNumericConversion { get; }

Property Value

bool

IsPointerConversion

Gets whether this conversion is a pointer conversion.

public virtual bool IsPointerConversion { get; }

Property Value

bool

IsReferenceConversion

Gets whether the conversion is a reference conversion.

public virtual bool IsReferenceConversion { get; }

Property Value

bool

IsThrowExpressionConversion

public virtual bool IsThrowExpressionConversion { get; }

Property Value

bool

IsTryCast

Gets whether the conversion is an 'as' cast.

public virtual bool IsTryCast { get; }

Property Value

bool

IsTupleConversion

Gets whether this conversion is a tuple conversion.

public virtual bool IsTupleConversion { get; }

Property Value

bool

IsUnboxingConversion

Gets whether this conversion is an unboxing conversion.

public virtual bool IsUnboxingConversion { get; }

Property Value

bool

IsUserDefined

Gets whether this conversion is user-defined (op_Implicit or op_Explicit).

public virtual bool IsUserDefined { get; }

Property Value

bool

IsValid

Gets whether the conversion is valid.

public virtual bool IsValid { get; }

Property Value

bool

IsVirtualMethodLookup

For method-group conversions, gets whether to perform a virtual method lookup at runtime.

public virtual bool IsVirtualMethodLookup { get; }

Property Value

bool

Method

Gets the method associated with this conversion. For user-defined conversions, this is the method being called. For method-group conversions, this is the method that was chosen from the group.

public virtual IMethod Method { get; }

Property Value

IMethod

Methods

EnumerationConversion(bool, bool)

public static Conversion EnumerationConversion(bool isImplicit, bool isLifted)

Parameters

isImplicit bool
isLifted bool

Returns

Conversion

Equals(Conversion)

public virtual bool Equals(Conversion other)

Parameters

other Conversion

Returns

bool

Equals(object)

public override sealed bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

InvalidMethodGroupConversion(IMethod, bool, bool)

public static Conversion InvalidMethodGroupConversion(IMethod chosenMethod, bool isVirtualMethodLookup, bool delegateCapturesFirstArgument)

Parameters

chosenMethod IMethod
isVirtualMethodLookup bool
delegateCapturesFirstArgument bool

Returns

Conversion

MethodGroupConversion(IMethod, bool, bool)

public static Conversion MethodGroupConversion(IMethod chosenMethod, bool isVirtualMethodLookup, bool delegateCapturesFirstArgument)

Parameters

chosenMethod IMethod
isVirtualMethodLookup bool
delegateCapturesFirstArgument bool

Returns

Conversion

TupleConversion(ImmutableArray<Conversion>)

public static Conversion TupleConversion(ImmutableArray<Conversion> conversions)

Parameters

conversions ImmutableArray<Conversion>

Returns

Conversion

UserDefinedConversion(IMethod, bool, Conversion, Conversion, bool, bool)

public static Conversion UserDefinedConversion(IMethod operatorMethod, bool isImplicit, Conversion conversionBeforeUserDefinedOperator, Conversion conversionAfterUserDefinedOperator, bool isLifted = false, bool isAmbiguous = false)

Parameters

operatorMethod IMethod
isImplicit bool
conversionBeforeUserDefinedOperator Conversion
conversionAfterUserDefinedOperator Conversion
isLifted bool
isAmbiguous bool

Returns

Conversion