3 implementations of IsReferenceType
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\TypeSymbol.cs (1)
119bool ITypeSymbol.IsReferenceType
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
59public bool IsReferenceType => _symbol.IsReferenceType;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\TypeSymbol.vb (1)
239Public MustOverride ReadOnly Property IsReferenceType As Boolean Implements ITypeSymbol.IsReferenceType, ITypeSymbolInternal.IsReferenceType
83 references to IsReferenceType
Microsoft.CodeAnalysis (7)
Operations\ControlFlowGraphBuilder.cs (3)
3458(operation.Type.IsReferenceType && !ITypeSymbolHelpers.IsNullableType(operation.Type)) 4143if (resource.Type.IsReferenceType) 4169((value.Type!.Equals(iDisposable) || (!value.Type.IsReferenceType && !ITypeSymbolHelpers.IsNullableType(value.Type))) && disposeArguments.IsDefaultOrEmpty));
Symbols\ITypeSymbol.cs (4)
56/// <see cref="IsReferenceType"/> and <see cref="IsValueType"/> both return true. However, for an unconstrained type 57/// parameter, <see cref="IsReferenceType"/> and <see cref="IsValueType"/> will both return false. 63/// <see cref="IsReferenceType"/> and <see cref="IsValueType"/> both return true. However, for an unconstrained type 64/// parameter, <see cref="IsReferenceType"/> and <see cref="IsValueType"/> will both return false.
Microsoft.CodeAnalysis.CodeStyle (5)
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
107!conditionType.IsReferenceType)
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
124if (!genericParameterSymbol.IsReferenceType && !unconstraintedGenericSupported)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
187return argsArgumentType is IArrayTypeSymbol arrayType && arrayType.ElementType.IsReferenceType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (1)
34var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (1)
1040if (receiverType.IsKind(SymbolKind.TypeParameter) && !receiverType.IsReferenceType)
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
546return parameterType.IsReferenceType || parameterType.IsNullable();
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
322constraints.FirstOrDefault(t => t.IsReferenceType);
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
279var condition3 = typeParameter.HasReferenceTypeConstraint && typeParameter.ConstraintTypes.Any(static ts => ts.IsReferenceType && ts.SpecialType != SpecialType.System_Object);
Microsoft.CodeAnalysis.CSharp (2)
Compilation\CSharpCompilation.cs (1)
2345if (sourceConstantValue is { IsNull: true } && destination.IsReferenceType)
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (1)
18else if (type.IsReferenceType || type.TypeKind == TypeKind.Pointer || ITypeSymbolHelpers.IsNullableType(type))
Microsoft.CodeAnalysis.CSharp.CodeStyle (5)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (5)
334if (isNullLiteralCast && !originalConvertedType.IsReferenceType && !originalConvertedType.IsNullable()) 561originalConvertedType.IsReferenceType && rewrittenConvertedType.TypeKind == TypeKind.Dynamic) 949if (!original.IsReferenceType || original.TypeKind == TypeKind.Interface) 1291if (!rewrittenType.IsReferenceType && 1402Debug.Assert(!rewrittenType.IsReferenceType && !IsIntrinsicOrEnum(rewrittenType));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
110var cannotUseVar = declaratorToRemoveType != null && (declaratorToRemoveType.IsReferenceType || declaratorToRemoveType.IsNullable());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
94_ => type == null || type.IsReferenceType || type is IPointerTypeSymbol || type.IsNullable()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
298if (constraintType.IsReferenceType && constraintType.TypeKind != TypeKind.Interface)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
57if (type != null && type.IsReferenceType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1152else if (symbol.IsReferenceType)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenTupleTest.cs (2)
16575Assert.True(xSymbol.IsReferenceType); 16612Assert.True(xSymbol.IsReferenceType);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
10692Assert.Equal(useCompilationReference || returnType.IsReferenceType, returnType.IsRecord);
Microsoft.CodeAnalysis.CSharp.Features (1)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (1)
110var cannotUseVar = declaratorToRemoveType != null && (declaratorToRemoveType.IsReferenceType || declaratorToRemoveType.IsNullable());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Compilation\GetSemanticInfoTests.cs (2)
6047Assert.False(symbol.IsReferenceType); 6049Assert.True(symbol.IsReferenceType);
Symbols\Source\DelegateTests.cs (1)
131Assert.True(v.IsReferenceType);
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
3231if (type.IsReferenceType ||
Simplification\Reducers\CSharpNullableAnnotationReducer.cs (1)
53if (type == null || !type.IsReferenceType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (5)
334if (isNullLiteralCast && !originalConvertedType.IsReferenceType && !originalConvertedType.IsNullable()) 561originalConvertedType.IsReferenceType && rewrittenConvertedType.TypeKind == TypeKind.Dynamic) 949if (!original.IsReferenceType || original.TypeKind == TypeKind.Interface) 1291if (!rewrittenType.IsReferenceType && 1402Debug.Assert(!rewrittenType.IsReferenceType && !IsIntrinsicOrEnum(rewrittenType));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (1)
94_ => type == null || type.IsReferenceType || type is IPointerTypeSymbol || type.IsNullable()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
298if (constraintType.IsReferenceType && constraintType.TypeKind != TypeKind.Interface)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
57if (type != null && type.IsReferenceType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1152else if (symbol.IsReferenceType)
Microsoft.CodeAnalysis.Features (10)
ConvertCast\AbstractConvertCastCodeRefactoringProvider.cs (2)
55if (type is { IsReferenceType: true } or { OriginalDefinition.SpecialType: SpecialType.System_Nullable_T }) 58var isReferenceType = type.IsReferenceType;
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
247if (parameter.Type.IsReferenceType)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
59public bool IsReferenceType => _symbol.IsReferenceType;
src\Analyzers\Core\Analyzers\UseCoalesceExpression\AbstractUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
107!conditionType.IsReferenceType)
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
124if (!genericParameterSymbol.IsReferenceType && !unconstraintedGenericSupported)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
187return argsArgumentType is IArrayTypeSymbol arrayType && arrayType.ElementType.IsReferenceType;
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (1)
546return parameterType.IsReferenceType || parameterType.IsNullable();
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
322constraints.FirstOrDefault(t => t.IsReferenceType);
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
279var condition3 = typeParameter.HasReferenceTypeConstraint && typeParameter.ConstraintTypes.Any(static ts => ts.IsReferenceType && ts.SpecialType != SpecialType.System_Object);
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\BoxingOperationAnalyzer.cs (2)
48if (conversion.Type.IsReferenceType && 64invocation.TargetMethod.ContainingType.IsReferenceType)
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
89if ((!localType.IsReferenceType || localType.SpecialType == SpecialType.System_String) && localType.SpecialType != SpecialType.None)
Microsoft.CodeAnalysis.VisualBasic (2)
Compilation\VisualBasicCompilation.vb (1)
1909If sourceConstantValue IsNot Nothing AndAlso sourceConstantValue.IsNothing AndAlso destination.IsReferenceType Then
Symbols\TypeSymbol.vb (1)
239Public MustOverride ReadOnly Property IsReferenceType As Boolean Implements ITypeSymbol.IsReferenceType, ITypeSymbolInternal.IsReferenceType
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (6)
Semantics\GetSemanticInfoTests.vb (6)
4703Assert.False(tpSymbol1.IsReferenceType) 4710Assert.False(tpSymbol1.IsReferenceType) 4713Assert.True(tpSymbol1.IsReferenceType) 4716Assert.False(tpSymbol1.IsReferenceType) 4719Assert.True(tpSymbol1.IsReferenceType) 4722Assert.False(tpSymbol1.IsReferenceType)
Microsoft.CodeAnalysis.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (1)
34var isNonNullableReferenceType = type.IsReferenceType && type.NullableAnnotation != NullableAnnotation.Annotated;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (1)
1040if (receiverType.IsKind(SymbolKind.TypeParameter) && !receiverType.IsReferenceType)
Microsoft.Extensions.Options.SourceGeneration (3)
Parser.cs (3)
169if (type.IsReferenceType) 418enumeratedIsNullable = enumeratedType.IsReferenceType || enumeratedType.NullableAnnotation == NullableAnnotation.Annotated; 588memberType.IsReferenceType || memberType.NullableAnnotation == NullableAnnotation.Annotated,
Microsoft.Gen.Logging (2)
Parsing\Parser.cs (1)
585IsReference = paramTypeSymbol.IsReferenceType,
Parsing\Parser.LogProperties.cs (1)
201IsReference = property.Type.IsReferenceType,
Microsoft.Interop.LibraryImportGenerator (2)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
710if (marshallerType.IsReferenceType && marshallerType.IsStatic)
Analyzers\CustomMarshallerAttributeFixer.cs (1)
194if (marshallerType.IsStatic && marshallerType.IsReferenceType)
Microsoft.Interop.SourceGeneration (2)
TypeSymbolExtensions.cs (2)
104if (type.TypeKind == TypeKind.TypeParameter && !type.IsReferenceType) 144return type.IsReferenceType;
Microsoft.Maui.Controls.BindingSourceGen (5)
ITypeSymbolExtensions.cs (2)
9 if (!enabledNullable && typeInfo.IsReferenceType) 33 typeInfo.IsReferenceType && typeInfo.NullableAnnotation == NullableAnnotation.Annotated;
PathParser.cs (3)
52 var isReferenceType = typeInfo.IsReferenceType; 109 var isReferenceType = typeInfo?.IsReferenceType ?? false; 191 var isReferenceType = typeSymbol?.IsReferenceType ?? false;
Microsoft.VisualStudio.LanguageServices (1)
ChangeSignature\ChangeSignatureDialogViewModel.ParameterViewModels.cs (1)
243return ParameterSymbol.ExplicitDefaultValue == null ? (ParameterSymbol.Type.IsReferenceType ? @null : @default) :