Compilation.CreateBuiltinOperator Method

Definition

Overloads

CreateBuiltinOperator(String, ITypeSymbol, ITypeSymbol, ITypeSymbol)

Creates an IMethodSymbol whose MethodKind is BuiltinOperator for a binary operator. Built-in operators are commonly created for symbols like bool int.operator ==(int v1, int v2) which the language implicitly supports, even if such a symbol is not explicitly defined for that type in either source or metadata.

CreateBuiltinOperator(String, ITypeSymbol, ITypeSymbol)

Creates an IMethodSymbol whose MethodKind is BuiltinOperator for a unary operator. Built-in operators are commonly created for symbols like bool int.operator -(int value) which the language implicitly supports, even if such a symbol is not explicitly defined for that type in either source or metadata.

CreateBuiltinOperator(String, ITypeSymbol, ITypeSymbol, ITypeSymbol)

Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs

Creates an IMethodSymbol whose MethodKind is BuiltinOperator for a binary operator. Built-in operators are commonly created for symbols like bool int.operator ==(int v1, int v2) which the language implicitly supports, even if such a symbol is not explicitly defined for that type in either source or metadata.

C#
public Microsoft.CodeAnalysis.IMethodSymbol CreateBuiltinOperator(string name, Microsoft.CodeAnalysis.ITypeSymbol returnType, Microsoft.CodeAnalysis.ITypeSymbol leftType, Microsoft.CodeAnalysis.ITypeSymbol rightType);

Parameters

name
String

The binary operator name. Should be one of the names from WellKnownMemberNames.

returnType
ITypeSymbol

The return type of the binary operator.

leftType
ITypeSymbol

The type of the left operand of the binary operator.

rightType
ITypeSymbol

The type of the right operand of the binary operator.

Returns

Applies to

Roslyn 4.13.0 och andra versioner
Produkt Versioner
Roslyn 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 4.12.2, 4.13.0

CreateBuiltinOperator(String, ITypeSymbol, ITypeSymbol)

Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs
Source:
Compilation.cs

Creates an IMethodSymbol whose MethodKind is BuiltinOperator for a unary operator. Built-in operators are commonly created for symbols like bool int.operator -(int value) which the language implicitly supports, even if such a symbol is not explicitly defined for that type in either source or metadata.

C#
public Microsoft.CodeAnalysis.IMethodSymbol CreateBuiltinOperator(string name, Microsoft.CodeAnalysis.ITypeSymbol returnType, Microsoft.CodeAnalysis.ITypeSymbol operandType);

Parameters

name
String

The unary operator name. Should be one of the names from WellKnownMemberNames.

returnType
ITypeSymbol

The return type of the unary operator.

operandType
ITypeSymbol

The type the operator applies to.

Returns

Applies to

Roslyn 4.13.0 och andra versioner
Produkt Versioner
Roslyn 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 4.12.2, 4.13.0