1 implementation of IConversionOperation
Microsoft.CodeAnalysis (1)
Generated\Operations.Generated.cs (1)
5092internal sealed partial class ConversionOperation : Operation, IConversionOperation
149 references to IConversionOperation
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (1)
106IConversionOperation c => ResolveType(c.Operand),
ILLink.RoslynAnalyzer (2)
DataFlow\LocalDataFlowVisitor.cs (1)
696 public override TValue VisitConversion (IConversionOperation operation, LocalDataFlowState<TValue, TContext, TValueLattice, TContextLattice> state)
TrimAnalysis\TrimAnalysisVisitor.cs (1)
120 public override MultiValue VisitConversion (IConversionOperation operation, StateValue state)
Microsoft.Analyzers.Local (4)
CallAnalysis\CallAnalyzer.Handlers.cs (1)
116if (op.Exception is IConversionOperation convOp)
CallAnalysis\Throws.cs (2)
30var convOp = (IConversionOperation?)op.Exception;
CallAnalysis\ToInvariantString.cs (1)
42if (a.Value is IConversionOperation conv)
Microsoft.AspNetCore.App.Analyzers (4)
Http\RequestDelegateReturnTypeAnalyzer.cs (1)
86while (operation is IConversionOperation conversionOperation)
RouteHandlers\DetectAmbiguousRoutes.cs (1)
287while (operation is IConversionOperation conversionOperation)
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (1)
62if (returnedValue is IConversionOperation conversionOperation)
RouteHandlers\RouteHandlerAnalyzer.cs (1)
238while (operation is IConversionOperation conversionOperation)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\InvocationOperationExtensions.cs (1)
86IConversionOperation conv => ResolveMethodFromOperation(conv.Operand, semanticModel),
Microsoft.AspNetCore.Mvc.Api.Analyzers (3)
ActualApiResponseMetadataFactory.cs (3)
74while (returnedValue is IConversionOperation conversion) 211while (operation is IConversionOperation conversionOperation) 228while (operation is IConversionOperation conversion)
Microsoft.CodeAnalysis (13)
Generated\OperationKind.Generated.cs (1)
59/// <summary>Indicates an <see cref="IConversionOperation"/>.</summary>
Generated\Operations.Generated.cs (3)
10896public override IOperation VisitConversion(IConversionOperation operation, object? argument) 11436public virtual void VisitConversion(IConversionOperation operation) => DefaultVisit(operation); 11575public virtual TResult? VisitConversion(IConversionOperation operation, TArgument argument) => DefaultVisit(operation, argument);
Operations\ControlFlowGraphBuilder.cs (9)
1619if (operation.WhenTrue is IConversionOperation whenTrueConversion && whenTrueConversion.Operand.Kind == OperationKind.Throw) 1631else if (operation.WhenFalse is IConversionOperation whenFalseConversion && whenFalseConversion.Operand.Kind == OperationKind.Throw) 2923var conversion = (IConversionOperation)condition; 3044var conversion = operation.WhenNull as IConversionOperation; 7056Debug.Assert(interpolation.FormatString is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7069Debug.Assert(interpolatedStringText.Text is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7422public override IOperation VisitConversion(IConversionOperation operation, int? captureIdForResult)
Microsoft.CodeAnalysis.CodeStyle (10)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (1)
250if (value is IConversionOperation conversion)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (1)
120if (pattern is IConstantPatternOperation { Value: IConversionOperation { ConstantValue: { HasValue: true, Value: null } } })
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (1)
197case ISingleValueCaseClauseOperation { Value: IConversionOperation { ConstantValue: { HasValue: true, Value: null } } }:
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
686var conversion = (IConversionOperation)assignmentValue;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
66case IConversionOperation { IsImplicit: true } conversion:
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
244if (operation is IConversionOperation conversion && conversion.IsImplicit)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
388while (operation is IConversionOperation conversionOperation) 459=> value is IConversionOperation conversion && conversion.IsImplicit
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
440currentOperation = ((IConversionOperation)currentOperation).Operand;
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
175if (value is IConversionOperation conversion &&
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
432return operation is IConversionOperation conversion && conversion.IsImplicit
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (1)
126Value: IConversionOperation { Operand: ITupleOperation valueTupleTemp },
Microsoft.CodeAnalysis.CSharp (6)
CSharpExtensions.cs (5)
778/// Gets the underlying <see cref="Conversion"/> information from this <see cref="IConversionOperation"/>. This 779/// <see cref="IConversionOperation"/> must have been created from CSharp code. 783/// <exception cref="InvalidCastException">If the <see cref="IConversionOperation"/> was not created from CSharp code.</exception> 784public static Conversion GetConversion(this IConversionOperation conversionExpression) 798nameof(IConversionOperation)),
Operations\CSharpOperationFactory.cs (1)
1139private IConversionOperation CreateBoundAsOperatorOperation(BoundAsOperator boundAsOperator)
Microsoft.CodeAnalysis.CSharp.CodeStyle (19)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
361if (operation is IConversionOperation conversionOperation)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (2)
129var leftConv = (leftTarget as IConversionOperation)?.Conversion; 130var rightConv = (rightTarget as IConversionOperation)?.Conversion;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (1)
162return operation is IConversionOperation { Conversion.IsUserDefined: false } op
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (15)
96while (current is IConversionOperation { Type.SpecialType: SpecialType.System_Delegate or SpecialType.System_MulticastDelegate }) 99if (current is IConversionOperation { Type.SpecialType: SpecialType.System_Object }) 106if (current.Parent is IConversionOperation { Type: { } parentConversionType, IsImplicit: false } && 204if (originalOperation is IConversionOperation originalConversionOperation) 221private static bool CastRemovalCouldCauseSignExtensionWarning(ExpressionSyntax castSyntax, IConversionOperation conversionOperation) 277if (originalDelegateCreationOperation.Parent is IConversionOperation conversionOperation && 289SemanticModel originalSemanticModel, IConversionOperation originalConversionOperation, 404if (originalConversionOperation.Parent is IConversionOperation { Conversion.IsUserDefined: true } originalParentConversionOperation) 734private static bool IsMultipleImplicitNullableConversion(IConversionOperation originalConversionOperation) 746if (originalConversionOperation.Parent is not IConversionOperation outerOriginalConversionOperation) 757ExpressionSyntax castNode, IConversionOperation originalConversionOperation, 799if (rewrittenOperation.Parent is not IConversionOperation rewrittenBitwiseNotConversionOperation) 841if (originalSemanticModel.GetOperation(castExpression, cancellationToken) is not IConversionOperation conversionOperation) 888if (rewrittenConditionalOperation.Parent is IConversionOperation conditionalParentConversion && 940if (operation is not IConversionOperation conversionOperation)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
582Value: IConversionOperation
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
64var isConvertedToReadOnlySpan = arrayOp.Parent is IConversionOperation conversion &&
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
FirstClassSpanTests.cs (4)
2864var op = (IConversionOperation)model.GetOperation(cast)!; 2880var op = (IConversionOperation)model.GetOperation(cast)!;
Semantics\CollectionExpressionTests.cs (4)
26743var conversionOperation = (IConversionOperation)((IReturnOperation)operation).ReturnedValue; 26798var conversionOperation = (IConversionOperation)((IReturnOperation)operation).ReturnedValue;
Microsoft.CodeAnalysis.CSharp.Features (7)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
911if (operation is IConversionOperation conversion && conversion.IsImplicit)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
361if (operation is IConversionOperation conversionOperation)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (2)
129var leftConv = (leftTarget as IConversionOperation)?.Conversion; 130var rightConv = (rightTarget as IConversionOperation)?.Conversion;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (1)
162return operation is IConversionOperation { Conversion.IsUserDefined: false } op
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (1)
582Value: IConversionOperation
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
64var isConvertedToReadOnlySpan = arrayOp.Parent is IConversionOperation conversion &&
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (6)
IOperation\IOperationTests_IArgument.cs (2)
4096var conversion = operation.Descendants().OfType<IConversionOperation>().Single();
IOperation\IOperationTests_IConversionExpression.cs (4)
381return (IConversionOperation)((ICoalesceOperation)initializer).WhenNull; 5353return ((IConversionOperation)operation).Operand; 5361public Func<IOperation, IConversionOperation> OperationSelector { get; set; } 5429case IConversionOperation conv:
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\DelegateTypeTests.cs (1)
14756var value = ((IConversionOperation)operation.Initializer!.Value).Operand;
Semantics\Utf8StringsLiteralsTests.cs (1)
3316Assert.True(((IConversionOperation)model.GetOperation(node)).GetConversion().IsSpan);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CompilationTestUtils.cs (1)
376if (iop is { Parent: IConversionOperation parentConversion })
Microsoft.CodeAnalysis.CSharp.Workspaces (15)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (15)
96while (current is IConversionOperation { Type.SpecialType: SpecialType.System_Delegate or SpecialType.System_MulticastDelegate }) 99if (current is IConversionOperation { Type.SpecialType: SpecialType.System_Object }) 106if (current.Parent is IConversionOperation { Type: { } parentConversionType, IsImplicit: false } && 204if (originalOperation is IConversionOperation originalConversionOperation) 221private static bool CastRemovalCouldCauseSignExtensionWarning(ExpressionSyntax castSyntax, IConversionOperation conversionOperation) 277if (originalDelegateCreationOperation.Parent is IConversionOperation conversionOperation && 289SemanticModel originalSemanticModel, IConversionOperation originalConversionOperation, 404if (originalConversionOperation.Parent is IConversionOperation { Conversion.IsUserDefined: true } originalParentConversionOperation) 734private static bool IsMultipleImplicitNullableConversion(IConversionOperation originalConversionOperation) 746if (originalConversionOperation.Parent is not IConversionOperation outerOriginalConversionOperation) 757ExpressionSyntax castNode, IConversionOperation originalConversionOperation, 799if (rewrittenOperation.Parent is not IConversionOperation rewrittenBitwiseNotConversionOperation) 841if (originalSemanticModel.GetOperation(castExpression, cancellationToken) is not IConversionOperation conversionOperation) 888if (rewrittenConditionalOperation.Parent is IConversionOperation conditionalParentConversion && 940if (operation is not IConversionOperation conversionOperation)
Microsoft.CodeAnalysis.Features (10)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
389return (collection is IConversionOperation conversion && conversion.IsImplicit)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
444return operation is IConversionOperation { Conversion.IsUserDefined: false } op
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (1)
250if (value is IConversionOperation conversion)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (1)
120if (pattern is IConstantPatternOperation { Value: IConversionOperation { ConstantValue: { HasValue: true, Value: null } } })
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (1)
197case ISingleValueCaseClauseOperation { Value: IConversionOperation { ConstantValue: { HasValue: true, Value: null } } }:
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
686var conversion = (IConversionOperation)assignmentValue;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
66case IConversionOperation { IsImplicit: true } conversion:
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
244if (operation is IConversionOperation conversion && conversion.IsImplicit)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (1)
175if (value is IConversionOperation conversion &&
Microsoft.CodeAnalysis.Test.Utilities (13)
Compilation\OperationTreeVerifier.cs (4)
1246public override void VisitConversion(IConversionOperation operation) 1248LogString(nameof(IConversionOperation)); 1913Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.Text).Operand.Kind); 1929Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.FormatString).Operand.Kind);
Compilation\TestOperationVisitor.cs (3)
838public override void VisitConversion(IConversionOperation operation) 1292Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.Text).Operand.Kind); 1310Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.FormatString).Operand.Kind);
Diagnostics\BoxingOperationAnalyzer.cs (2)
47IConversionOperation conversion = (IConversionOperation)operation;
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
283IConversionOperation conversion = (IConversionOperation)value;
Diagnostics\OperationTestAnalyzer.cs (2)
1894var conversion = (IConversionOperation)operationContext.Operation;
Microsoft.CodeAnalysis.VisualBasic (4)
VisualBasicExtensions.vb (4)
1381''' Gets the underlying <see cref="Conversion"/> information from an <see cref="IConversionOperation"/> that was created from Visual Basic code. 1385''' <exception cref="InvalidCastException">If the <see cref="IConversionOperation"/> was not created from Visual Basic code.</exception> 1387Public Function GetConversion(conversionExpression As IConversionOperation) As Conversion 1392NameOf(IConversionOperation)),
Microsoft.CodeAnalysis.Workspaces (5)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (2)
388while (operation is IConversionOperation conversionOperation) 459=> value is IConversionOperation conversion && conversion.IsImplicit
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
440currentOperation = ((IConversionOperation)currentOperation).Operand;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
432return operation is IConversionOperation conversion && conversion.IsImplicit
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (1)
126Value: IConversionOperation { Operand: ITupleOperation valueTupleTemp },
Microsoft.Interop.ComInterfaceGenerator (5)
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (5)
141var operation = (IConversionOperation)context.Operation; 146if (operand is IConversionOperation { Type.SpecialType: SpecialType.System_Object } objConversion) 174if (operand is IConversionOperation { Type.SpecialType: SpecialType.System_Object } objConversion) 202IConversionOperation conversion => (conversion.Operand.Type, conversion.Operand.Syntax.GetLocation()),
Roslyn.Compilers.VisualBasic.IOperation.UnitTests (5)
IOperation\IOperationTests_IConversionExpression.vb (5)
2598Function(operation As IOperation) As IConversionOperation 2601Return DirectCast(initializerValue, IInvalidOperation).ChildOperations.Cast(Of IConversionOperation).Single() 3348Return DirectCast(conv, IConversionOperation).Operand 3354Private ReadOnly _operationSelector As Func(Of IOperation, IConversionOperation) 3360Public Sub New(Optional operationSelector As Func(Of IOperation, IConversionOperation) = Nothing,