2 implementations of ConstantValue
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\FieldSymbol.cs (1)
96object IFieldSymbol.ConstantValue => _underlying.ConstantValue;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\FieldSymbol.vb (1)
488Private ReadOnly Property IFieldSymbol_ConstantValue As Object Implements IFieldSymbol.ConstantValue
77 references to ConstantValue
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
AddResponseTypeAttributeCodeFixAction.cs (1)
159field.ConstantValue is int statusCode)
Microsoft.CodeAnalysis (2)
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (1)
324var enumField = new EnumField(field.Name, underlyingSpecialType.ConvertUnderlyingValueToUInt64(field.ConstantValue), field);
Symbols\IFieldSymbol.cs (1)
88[MemberNotNullWhen(true, nameof(ConstantValue))]
Microsoft.CodeAnalysis.CodeStyle (3)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (2)
163if (fieldSymbol.ConstantValue == null) 173var enumValue = IntegerUtilities.ToInt64(fieldSymbol.ConstantValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
25.Select(f => f.ConstantValue)
Microsoft.CodeAnalysis.CodeStyle.Fixes (6)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (6)
151Contract.ThrowIfNull(field.ConstantValue); 152return CreateExplicitlyCastedLiteralValue(generator, enumType, underlyingSpecialType, field.ConstantValue); 178if (field is { HasConstantValue: true, ConstantValue: not null }) 180var value = underlyingSpecialType.ConvertUnderlyingValueToUInt64(field.ConstantValue); 197if (field is { HasConstantValue: true, ConstantValue: not null }) 199var fieldValue = underlyingSpecialType.ConvertUnderlyingValueToUInt64(field.ConstantValue);
Microsoft.CodeAnalysis.CSharp (4)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (2)
87CanAddConstant(symbol.Type, symbol.ConstantValue)) 93AddConstantValue(symbol.Type, symbol.ConstantValue, preferNumericValueOrExpandedFlagsForEnum: IsEnumMember(symbol));
Symbols\TypedConstantExtensions.cs (2)
89ConstantValue memberConstant = ConstantValue.Create(field.ConstantValue, specialType); 167ConstantValue memberConstant = ConstantValue.Create(field.ConstantValue, specialType);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
88type.GetMembers("None").FirstOrDefault() is IFieldSymbol field && IsZero(field.ConstantValue))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (3)
81if (enumMember.ConstantValue is not byte and 93var value = IntegerUtilities.ToInt64(enumMember.ConstantValue); 166enumMember.ConstantValue,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
116return EqualsValueClause(ExpressionGenerator.GenerateExpression(generator, field.Type, field.ConstantValue, canUseFieldReference));
Microsoft.CodeAnalysis.CSharp.Features (3)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
190foreach (var field in fields.OrderBy(f => IntegerUtilities.ToInt64(f.ConstantValue)))
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
102field.ConstantValue,
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
88type.GetMembers("None").FirstOrDefault() is IFieldSymbol field && IsZero(field.ConstantValue))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Compilation\SemanticModelGetSemanticInfoTests.cs (3)
4624Assert.Equal(2, symbol.ConstantValue); 4692Assert.Equal(2, symbol.ConstantValue); 4833Assert.Equal(3, symbol.ConstantValue);
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (3)
81if (enumMember.ConstantValue is not byte and 93var value = IntegerUtilities.ToInt64(enumMember.ConstantValue); 166enumMember.ConstantValue,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
116return EqualsValueClause(ExpressionGenerator.GenerateExpression(generator, field.Type, field.ConstantValue, canUseFieldReference));
Microsoft.CodeAnalysis.Features (2)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (2)
163if (fieldSymbol.ConstantValue == null) 173var enumValue = IntegerUtilities.ToInt64(fieldSymbol.ConstantValue);
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\CommonDiagnosticAnalyzers.cs (1)
1445var diagnostic = Diagnostic.Create(Descriptor, operation.Syntax.GetLocation(), operation.Field.Name, operation.Field.ConstantValue);
Microsoft.CodeAnalysis.VisualBasic (4)
SymbolDisplay\SymbolDisplayVisitor.Members.vb (1)
58AddConstantValue(symbol.Type, symbol.ConstantValue, preferNumericValueOrExpandedFlagsForEnum:=IsEnumMember(symbol))
Symbols\FieldSymbol.vb (1)
488Private ReadOnly Property IFieldSymbol_ConstantValue As Object Implements IFieldSymbol.ConstantValue
Symbols\TypedConstant.vb (2)
82Dim memberConstant = ConstantValue.Create(field.ConstantValue, splType) 147Dim memberConstant = ConstantValue.Create(field.ConstantValue, splType)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (11)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (10)
57If TypeOf enumMember.ConstantValue IsNot Byte AndAlso 58TypeOf enumMember.ConstantValue IsNot SByte AndAlso 59TypeOf enumMember.ConstantValue IsNot UShort AndAlso 60TypeOf enumMember.ConstantValue IsNot Short AndAlso 61TypeOf enumMember.ConstantValue IsNot Integer AndAlso 62TypeOf enumMember.ConstantValue IsNot UInteger AndAlso 63TypeOf enumMember.ConstantValue IsNot Long AndAlso 64TypeOf enumMember.ConstantValue IsNot ULong Then 68Dim value = IntegerUtilities.ToInt64(enumMember.ConstantValue) 141enumMember.ConstantValue,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\FieldGenerator.vb (1)
97Return SyntaxFactory.EqualsValue(ExpressionGenerator.GenerateExpression(generator, field.Type, field.ConstantValue, canUseFieldReference))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (11)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (10)
57If TypeOf enumMember.ConstantValue IsNot Byte AndAlso 58TypeOf enumMember.ConstantValue IsNot SByte AndAlso 59TypeOf enumMember.ConstantValue IsNot UShort AndAlso 60TypeOf enumMember.ConstantValue IsNot Short AndAlso 61TypeOf enumMember.ConstantValue IsNot Integer AndAlso 62TypeOf enumMember.ConstantValue IsNot UInteger AndAlso 63TypeOf enumMember.ConstantValue IsNot Long AndAlso 64TypeOf enumMember.ConstantValue IsNot ULong Then 68Dim value = IntegerUtilities.ToInt64(enumMember.ConstantValue) 141enumMember.ConstantValue,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\FieldGenerator.vb (1)
97Return SyntaxFactory.EqualsValue(ExpressionGenerator.GenerateExpression(generator, field.Type, field.ConstantValue, canUseFieldReference))
Microsoft.CodeAnalysis.Workspaces (10)
Editing\SyntaxGenerator.cs (1)
135var initializer = field.HasConstantValue ? this.LiteralExpression(field.ConstantValue, canUseFieldReference) : null;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
25.Select(f => f.ConstantValue)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (6)
151Contract.ThrowIfNull(field.ConstantValue); 152return CreateExplicitlyCastedLiteralValue(generator, enumType, underlyingSpecialType, field.ConstantValue); 178if (field is { HasConstantValue: true, ConstantValue: not null }) 180var value = underlyingSpecialType.ConvertUnderlyingValueToUInt64(field.ConstantValue); 197if (field is { HasConstantValue: true, ConstantValue: not null }) 199var fieldValue = underlyingSpecialType.ConvertUnderlyingValueToUInt64(field.ConstantValue);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
167? Comparer<object>.Default.Compare(f1.ConstantValue, f2.ConstantValue!)
Microsoft.Gen.Metrics (2)
Parser.cs (2)
379fieldSymbol.ConstantValue == null) 387tagDescriptionDictionary.Add(fieldSymbol.ConstantValue.ToString(), xmlDefinition);
Microsoft.Gen.MetricsReports (2)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (2)
379fieldSymbol.ConstantValue == null) 387tagDescriptionDictionary.Add(fieldSymbol.ConstantValue.ToString(), xmlDefinition);
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
ObjectBrowser\DescriptionBuilder.vb (2)
236If fieldSymbol.ConstantValue Is Nothing Then 239AddText(fieldSymbol.ConstantValue.ToString())
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationInfo.cs (1)
24ConstantValue: int value