5 overrides of IsEnum
System.Private.CoreLib (3)
src\libraries\System.Private.CoreLib\src\System\Reflection\ModifiedType.cs (1)
172public override bool IsEnum => _unmodifiedType.IsEnum;
src\libraries\System.Private.CoreLib\src\System\Reflection\SignatureType.cs (1)
191public sealed override bool IsEnum => throw new NotSupportedException(SR.NotSupported_SignatureType);
src\System\RuntimeType.CoreCLR.cs (1)
3426public override unsafe bool IsEnum
System.Reflection.Context (1)
System\Reflection\Context\Delegation\DelegatingType.cs (1)
77public override bool IsEnum
System.Reflection.MetadataLoadContext (1)
System\Reflection\TypeLoading\Types\RoType.cs (1)
269public override bool IsEnum => (GetBaseTypeClassification() & BaseTypeClassification.IsEnum) != 0;
319 references to IsEnum
dotnet-svcutil-lib (24)
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeGenerator.cs (3)
1129else if (valueType.GetTypeInfo().IsEnum) 1522if (arrayElementType.GetTypeInfo().IsEnum) 1604if (arrayElementType.GetTypeInfo().IsEnum)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (2)
578if (type.GetTypeInfo().IsEnum) 870else if (info.IsEnum)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlReflectionImporter.cs (1)
1435if (!type.GetTypeInfo().IsEnum)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (1)
1764if (!isPrimitive && !elementType.GetTypeInfo().IsEnum)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (2)
1392bool needXsiType = t != ambientType && !t.GetTypeInfo().IsEnum; 3584if (type.GetTypeInfo().IsEnum)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ClassDataContract.cs (3)
372string.Format((declaringType.GetTypeInfo().IsEnum ? SRSerialization.DupEnumMemberValue : SRSerialization.DupMemberName), 386if (!childType.GetTypeInfo().IsEnum && !Globals.TypeOfIXmlSerializable.IsAssignableFrom(childType) 413if (type.GetTypeInfo().IsEnum)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeGenerator.cs (3)
977else if (valueType.GetTypeInfo().IsEnum) 1268if (arrayElementType.GetTypeInfo().IsEnum) 1332if (arrayElementType.GetTypeInfo().IsEnum)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (3)
700else if (type.GetTypeInfo().IsEnum) 848if (type.GetTypeInfo().IsEnum) // Type.GetTypeCode will report Enums as TypeCode.IntXX 1290if (type.GetTypeInfo().IsEnum ||
FrameworkFork\System.ServiceModel\Extensions\ReflectionExtensions.cs (2)
60return type.GetTypeInfo().IsEnum; 164if (type.GetTypeInfo().IsEnum)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\OperationGenerator.cs (1)
1027if (info.IsEnum)
Shared\Options\OptionValueParser.cs (3)
42else if (valueType.GetTypeInfo().IsEnum) 100else if (valueType.GetTypeInfo().IsEnum) 184else if (valueType.GetTypeInfo().IsEnum)
Microsoft.AspNetCore.Components (4)
BindConverter.cs (4)
1782else if (typeof(T).IsEnum || Nullable.GetUnderlyingType(typeof(T)) is Type { IsEnum: true } innerType) 1981else if (typeof(T).IsEnum) 1987else if (Nullable.GetUnderlyingType(typeof(T)) is Type innerType && innerType.IsEnum)
Microsoft.AspNetCore.Components.Endpoints (2)
FormMapping\Factories\EnumConverterFactory.cs (1)
12public bool CanConvert(Type type, FormDataMapperOptions options) => type.IsEnum;
FormMapping\Metadata\FormDataMetadataFactory.cs (1)
81if (_parsableFactory.CanConvert(type, options) || type.IsEnum ||
Microsoft.AspNetCore.Components.Server.Tests (1)
Circuits\RenderBatchWriterTest.cs (1)
320var expectedEntry = expectedEntryIterationVar.GetType().IsEnum
Microsoft.AspNetCore.Connections.Abstractions (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
48if (underlyingType != null && underlyingType.IsEnum)
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\Json\JsonConverterFactoryForEnum.cs (1)
22return typeToConvert.IsEnum;
Microsoft.AspNetCore.Http.Abstractions (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
48if (underlyingType != null && underlyingType.IsEnum)
Microsoft.AspNetCore.Http.Extensions (3)
src\Components\Endpoints\src\FormMapping\Factories\EnumConverterFactory.cs (1)
12public bool CanConvert(Type type, FormDataMapperOptions options) => type.IsEnum;
src\Components\Endpoints\src\FormMapping\Metadata\FormDataMetadataFactory.cs (1)
81if (_parsableFactory.CanConvert(type, options) || type.IsEnum ||
src\Shared\ParameterBindingMethodCache.cs (1)
94if (type.IsEnum)
Microsoft.AspNetCore.Mvc.Abstractions (1)
src\Shared\ParameterBindingMethodCache.cs (1)
94if (type.IsEnum)
Microsoft.AspNetCore.Mvc.Core (2)
ModelBinding\ModelBindingHelper.cs (1)
701if (destinationType.IsEnum &&
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
48if (underlyingType != null && underlyingType.IsEnum)
Microsoft.AspNetCore.Mvc.DataAnnotations (1)
DataAnnotationsMetadataProvider.cs (1)
161if (underlyingType.IsEnum)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
BsonTempDataSerializer.cs (1)
240type.IsEnum ||
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
Infrastructure\DefaultTempDataSerializer.cs (1)
224type.IsEnum ||
TemplateRenderer.cs (1)
187if (fieldType.IsEnum)
Microsoft.AspNetCore.OpenApi (3)
Services\OpenApiDocumentService.cs (2)
708&& parameter.ModelMetadata.ModelType.IsEnum; 712var hasTryParse = bindingMetadata?.HasTryParse == true && parameterType is not null && !parameterType.IsEnum;
src\Shared\ParameterBindingMethodCache.cs (1)
94if (type.IsEnum)
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
48if (underlyingType != null && underlyingType.IsEnum)
Microsoft.Build (2)
Evaluation\Expander.cs (1)
4114else if (parameters[n].ParameterType.GetTypeInfo().IsEnum && args[n] is string v && v.Contains("."))
TaskParameter.cs (1)
162if (wrappedParameterType.IsEnum)
Microsoft.Build.Engine.UnitTests (1)
BackEnd\TranslationHelpers.cs (1)
164|| type.IsEnum
Microsoft.Build.Tasks.Core (1)
WriteCodeFragment.cs (1)
596if (targetType.IsEnum)
Microsoft.CodeAnalysis (3)
CodeGen\MetadataConstant.cs (1)
34Debug.Assert(value == null || value is string || value is DateTime || value is decimal || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is IntPtr) && !(value is UIntPtr)));
PEWriter\MetadataWriter.PortablePdb.cs (1)
247Debug.Assert(!value.GetType().GetTypeInfo().IsEnum);
Symbols\TypedConstantValue.cs (1)
25Debug.Assert(value == null || value is string || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is System.IntPtr) && !(value is System.UIntPtr)) || value is ITypeSymbol);
Microsoft.CodeAnalysis.CodeStyle (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (2)
98type.IsEnum || 99Nullable.GetUnderlyingType(type)?.IsEnum == true ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
183Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 193Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead.");
Microsoft.CodeAnalysis.CSharp (1)
SymbolDisplay\ObjectDisplay.cs (1)
49if (type.GetTypeInfo().IsEnum)
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider (1)
src\Compilers\CSharp\Portable\SymbolDisplay\ObjectDisplay.cs (1)
49if (type.GetTypeInfo().IsEnum)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
InteractiveSessionTests.cs (1)
245Assert.True(e.GetType().GetTypeInfo().IsEnum, "Expected enum");
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
Debugger\MemberInfo\TypeImpl.cs (1)
270get { return this.Type.IsEnum; }
Microsoft.CodeAnalysis.Features (1)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
121else if (defaultValue.Value?.GetType() is Type t && t.IsEnum)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (2)
Configuration\DidChangeConfigurationNotificationHandlerTest.cs (2)
281else if (type.IsEnum) 294else if (Nullable.GetUnderlyingType(type)?.IsEnum == true)
Microsoft.CodeAnalysis.Scripting (1)
Hosting\ObjectFormatter\CommonPrimitiveFormatter.cs (1)
57if (type.GetTypeInfo().IsEnum)
Microsoft.CodeAnalysis.Test.Utilities (1)
Syntax\NodeHelpers.cs (1)
195typeObject.GetTypeInfo().IsEnum)
Microsoft.CodeAnalysis.VisualBasic (1)
SymbolDisplay\ObjectDisplay.vb (1)
45If type.GetTypeInfo().IsEnum Then
Microsoft.CodeAnalysis.VisualBasic.ResultProvider (1)
src\Compilers\VisualBasic\Portable\SymbolDisplay\ObjectDisplay.vb (1)
45If type.GetTypeInfo().IsEnum Then
Microsoft.CodeAnalysis.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (2)
98type.IsEnum || 99Nullable.GetUnderlyingType(type)?.IsEnum == true ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
183Debug.Assert(value == null || !value.GetType().GetTypeInfo().IsEnum, "Enum should not be written with WriteValue. Write them as ints instead."); 193Debug.Assert(!typeInfo.IsEnum, "Enums should not be written with WriteObject. Write them out as integers instead.");
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Options\OptionsTestHelpers.cs (2)
125_ when type.IsEnum => GetDifferentEnumValue(type, value!), 126_ when Nullable.GetUnderlyingType(type) is { IsEnum: true } underlying => value is null ? Enum.ToObject(underlying, 1) : null,
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
ObjectSerializationTests.cs (2)
95r => value != null && value.GetType().IsEnum 156if (typeof(T).IsEnum)
Options\NamingStylePreferencesTests.cs (1)
202Assert.True(type.IsEnum);
Microsoft.CSharp (1)
Microsoft\CSharp\RuntimeBinder\SymbolTable.cs (1)
857else if (type.IsEnum)
Microsoft.Extensions.AI.Abstractions (6)
src\Shared\JsonSchemaExporter\JsonSchemaExporter.cs (3)
230Debug.Assert(elementTypeInfo.Type.IsEnum, "The enum keyword should only be populated by schemas for enum types."); 432else if (typeInfo.Type.IsEnum) 732Debug.Assert(typeInfo.Type.IsEnum && ReflectionHelpers.IsBuiltInConverter(converter), "must be using a built-in enum converter.");
src\Shared\JsonSchemaExporter\JsonSchemaExporter.ReflectionHelpers.cs (2)
321if (parameterType.IsEnum) 326if (Nullable.GetUnderlyingType(parameterType) is Type underlyingType && underlyingType.IsEnum)
Utilities\AIJsonUtilities.Schema.cs (1)
271if (key.IncludeTypeInEnumSchemas && ctx.TypeInfo.Type.IsEnum && objSchema.ContainsKey(EnumPropertyName) && !objSchema.ContainsKey(TypePropertyName))
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
190Enum = p.ParameterType?.IsEnum == true ? Enum.GetNames(p.ParameterType) : null,
Microsoft.Extensions.Configuration.Binder (4)
ConfigurationBinder.cs (3)
631bool keyTypeIsEnum = keyType.IsEnum; 704bool keyTypeIsEnum = keyType.IsEnum; 866bool elementTypeIsEnum = elementType.IsEnum;
src\libraries\Common\src\Extensions\ParameterDefaultValue\ParameterDefaultValue.cs (1)
53if (underlyingType != null && underlyingType.IsEnum)
Microsoft.Extensions.DependencyInjection (1)
src\libraries\Common\src\Extensions\ParameterDefaultValue\ParameterDefaultValue.cs (1)
53if (underlyingType != null && underlyingType.IsEnum)
Microsoft.Extensions.DependencyInjection.Abstractions (1)
src\libraries\Common\src\Extensions\ParameterDefaultValue\ParameterDefaultValue.cs (1)
53if (underlyingType != null && underlyingType.IsEnum)
Microsoft.Maui.Controls (1)
Xaml\TypeConversionExtensions.cs (1)
172 if (toType.IsEnum)
Microsoft.ML.AutoML (1)
TrainerExtensions\TrainerExtensionUtil.cs (1)
279else if (fi.FieldType.IsEnum)
Microsoft.ML.CodeGenerator (1)
CodeGenerator\CSharp\TrainerGeneratorBase.cs (1)
100if (type.IsEnum)
Microsoft.ML.Core (5)
CommandLine\CmdParser.cs (4)
1134typeBase.IsEnum; 1308else if (type.IsEnum) 1892Contracts.Assert(type.IsEnum); 2225else if (type.IsEnum)
EntryPoints\ModuleArgs.cs (1)
629if (type.IsEnum)
Microsoft.ML.Data (1)
EntryPoints\InputBuilder.cs (1)
306else if (type.IsEnum)
Microsoft.ML.Ensemble (1)
Selector\SubModelSelector\BaseBestPerformanceSelector.cs (1)
48Contracts.Assert(type.IsEnum);
Microsoft.ML.SearchSpace (1)
SearchSpace.cs (1)
304Contract.Assert(supportTypes.Contains(type) || type.IsEnum, $"[Option:{optionName}] ChoiceAttribute can only apply to enum or the following types {string.Join(",", supportTypes.Select(x => x.Name))}");
Microsoft.VisualBasic.Core (26)
Microsoft\VisualBasic\CompilerServices\ObjectFlowControl.vb (3)
187If (startTypeCode = widestTypeCode) AndAlso startType.IsEnum Then 191If (limitTypeCode = widestTypeCode) AndAlso limitType.IsEnum Then 201If (stepTypeCode = widestTypeCode) AndAlso stepType.IsEnum Then
Microsoft\VisualBasic\CompilerServices\ObjectType.vb (13)
314If Type1.IsEnum() Then 365If ToType.IsEnum() Then 1147If Type1.IsEnum Then 1155If Type1.IsEnum Then 1163If Type1.IsEnum Then 1171If Type1.IsEnum Then 1217Type1IsEnum = Type1.IsEnum() 1221Type2IsEnum = Type2.IsEnum() 1314Type1IsEnum = Type1.IsEnum() 1318Type2IsEnum = Type2.IsEnum() 1411Type1IsEnum = Type1.IsEnum() 1415Type2IsEnum = Type2.IsEnum() 3570If toType.IsEnum Then
Microsoft\VisualBasic\CompilerServices\Operators.vb (8)
1195If operandType.IsEnum Then 1204If operandType.IsEnum Then 1213If operandType.IsEnum Then 1222If operandType.IsEnum Then 1231If operandType.IsEnum Then 1240If operandType.IsEnum Then 1253If operandType.IsEnum Then 1262If operandType.IsEnum Then
Microsoft\VisualBasic\CompilerServices\VB6File.vb (1)
2158If typ.IsEnum() Then
Microsoft\VisualBasic\CompilerServices\VB6RandomFile.vb (1)
452ElseIf typ.IsEnum Then
Microsoft.VisualStudio.LanguageServices (4)
Options\VisualStudioSettingsOptionPersister.cs (4)
107if (storageType.IsEnum) 111if (underlyingType?.IsEnum == true) 227if (type.IsEnum || Nullable.GetUnderlyingType(type)?.IsEnum == true)
MSBuild (1)
TaskParameter.cs (1)
162if (wrappedParameterType.IsEnum)
MSBuildTaskHost (1)
TaskParameter.cs (1)
162if (wrappedParameterType.IsEnum)
PresentationBuildTasks (5)
MS\Internal\MarkupCompiler\MarkupCompiler.cs (1)
1802else if (typeToConvertTo.IsEnum)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\BamlMapTable.cs (1)
1403if (converterOrSerializerType == null && attributeType.IsEnum)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\BamlRecords.cs (1)
2508if (ValueType != null && ValueType.IsEnum)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlTypeMapper.cs (1)
716if (propType.IsEnum && attribValue != string.Empty)
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
150if (type.IsEnum)
PresentationFramework (13)
MS\Internal\TraceData.cs (1)
251if (type.IsPrimitive || type.IsEnum)
MS\Internal\WindowsRuntime\Generated\WinRT\GuidGenerator.cs (1)
70if (type.IsEnum)
System\Windows\Controls\DataGridColumn.cs (1)
1152if (propertyType.IsEnum)
System\Windows\Markup\Baml2006\Baml2006Reader.cs (1)
1592if (propertyType.IsEnum)
System\Windows\Markup\Baml2006\WpfSharedBamlSchemaContext.cs (1)
254if (converterType.IsEnum)
System\Windows\Markup\BamlMapTable.cs (3)
252Debug.Assert(type.IsEnum); 541Debug.Assert(propType.IsEnum); 1403if (converterOrSerializerType == null && attributeType.IsEnum)
System\Windows\Markup\BamlReader.cs (1)
1058if (!_propertyDP.PropertyType.IsEnum)
System\Windows\Markup\BamlRecords.cs (2)
2508if (ValueType != null && ValueType.IsEnum) 2739if (propertyType.IsEnum)
System\Windows\Markup\SetterTriggerConditionValueConverter.cs (1)
117if (xamlProperty.Type.UnderlyingType.IsEnum && schemaContext is Baml2006.Baml2006SchemaContext)
System\Windows\Markup\XamlTypeMapper.cs (1)
716if (propType.IsEnum && attribValue != string.Empty)
System.Collections.Immutable (6)
System\Collections\Frozen\Constants.cs (1)
74typeof(T).IsEnum;
System\Collections\Frozen\Integer\DenseIntegralFrozenDictionary.cs (5)
42if (typeof(TKey) == typeof(byte) || (typeof(TKey).IsEnum && typeof(TKey).GetEnumUnderlyingType() == typeof(byte))) 45if (typeof(TKey) == typeof(sbyte) || (typeof(TKey).IsEnum && typeof(TKey).GetEnumUnderlyingType() == typeof(sbyte))) 48if (typeof(TKey) == typeof(ushort) || (typeof(TKey).IsEnum && typeof(TKey).GetEnumUnderlyingType() == typeof(ushort))) 51if (typeof(TKey) == typeof(short) || (typeof(TKey).IsEnum && typeof(TKey).GetEnumUnderlyingType() == typeof(short))) 54if (typeof(TKey) == typeof(int) || (typeof(TKey).IsEnum && typeof(TKey).GetEnumUnderlyingType() == typeof(int)))
System.ComponentModel.Annotations (3)
System\ComponentModel\DataAnnotations\EnumDataTypeAttribute.cs (3)
28if (!EnumType.IsEnum) 44if (valueType.IsEnum && EnumType != valueType) 67if (valueType.IsEnum)
System.ComponentModel.Composition (2)
Microsoft\Internal\GenerationServices.cs (1)
87if (valueType.IsEnum)
System\ComponentModel\Composition\Hosting\CompositionServices.cs (1)
636if (type.IsEnum && type.IsVisible)
System.ComponentModel.TypeConverter (4)
System\ComponentModel\EnumConverter.cs (1)
26if (!type.IsEnum && !type.Equals(typeof(Enum)))
System\ComponentModel\ReflectPropertyDescriptor.cs (2)
202if (_defaultValue != null && PropertyType.IsEnum && PropertyType.GetEnumUnderlyingType() == _defaultValue.GetType()) 302bool storedAsUnderlyingType = defaultValue != null && PropertyType.IsEnum && PropertyType.GetEnumUnderlyingType() == defaultValue.GetType();
System\ComponentModel\ReflectTypeDescriptionProvider.cs (1)
1566if (callingType.IsEnum)
System.Configuration.ConfigurationManager (2)
System\Configuration\ConfigurationProperty.cs (1)
385if (Type.IsEnum)
System\Diagnostics\TraceUtils.cs (1)
198return type.IsEnum ?
System.Data.Common (4)
System\Data\DataRowExtensions.cs (3)
196Type fromType = valueType.IsEnum ? Enum.GetUnderlyingType(valueType) : valueType; 197Type toType = nullableType.IsEnum ? Enum.GetUnderlyingType(nullableType) : nullableType; 199value = nullableType.IsEnum ? Enum.ToObject(nullableType, value) : Convert.ChangeType(value, nullableType, null);
System\Data\TypeLimiter.cs (1)
277if (type.IsEnum)
System.Linq (1)
System\Linq\OrderBy.cs (1)
146if (typeof(T).IsEnum)
System.Linq.Expressions (38)
System\Dynamic\Utils\TypeUtils.cs (11)
109if (!type.IsEnum) 134if (!type.IsEnum) 156if (!type.IsEnum) 172if (!type.IsEnum) 194if (!type.IsEnum) 211if (!type.IsEnum) 259if (instanceType.IsEnum && AreReferenceAssignable(targetType, typeof(Enum))) 316|| source.IsEnum && source.GetEnumUnderlyingType() == typeof(bool)); 594if (type.IsEnum) 675return nnType == typeof(bool) || IsNumeric(nnType) || nnType.IsEnum; 860source.IsValueType && (destination == typeof(object) || destination == typeof(ValueType)) || source.IsEnum && destination == typeof(Enum);
System\Linq\Expressions\BinaryExpression.cs (1)
1057left.Type.GetNonNullableType().IsEnum))
System\Linq\Expressions\Compiler\ILGen.cs (1)
1069Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs (1)
152Debug.Assert(leftType.IsPrimitive || (op == ExpressionType.Equal || op == ExpressionType.NotEqual) && (!leftType.IsValueType || leftType.IsEnum));
System\Linq\Expressions\Interpreter\CallInstruction.Generated.cs (3)
44if (t.IsEnum) return SlowCreate(target, pi); 88if (t.IsEnum) return SlowCreate(target, pi); 132if (t.IsEnum) return SlowCreate(target, pi);
System\Linq\Expressions\Interpreter\DecrementInstruction.cs (1)
157Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\DivInstruction.cs (1)
165Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\GreaterThanInstruction.cs (1)
279Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\GreaterThanOrEqualInstruction.cs (1)
279Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\IncrementInstruction.cs (1)
157Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\LessThanInstruction.cs (1)
278Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\LessThanOrEqualInstruction.cs (1)
279Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\LightCompiler.cs (6)
448return type.IsValueType && !type.IsEnum && !type.IsPrimitive; 1143if ((nonNullableFrom.IsNumericOrBool() || nonNullableFrom.IsEnum) 1144&& (nonNullableTo.IsNumericOrBool() || nonNullableTo.IsEnum || nonNullableTo == typeof(decimal))) 1148if (nonNullableFrom.IsEnum) 1152if (nonNullableTo.IsEnum) 1202if (typeTo.IsEnum)
System\Linq\Expressions\Interpreter\ModuloInstruction.cs (1)
165Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\NegateInstruction.cs (2)
106Debug.Assert(!type.IsEnum); 182Debug.Assert(!type.IsEnum);
System\Linq\Expressions\Interpreter\TypeOperations.cs (3)
356Debug.Assert(!t.IsEnum); 386Debug.Assert(t.IsEnum); 410Debug.Assert(t.IsEnum);
System\Linq\Expressions\Interpreter\Utilities.cs (1)
146if (type.IsEnum)
System\Linq\Expressions\ParameterExpression.cs (1)
28if (!type.IsEnum)
System.Private.CoreLib (47)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipePayloadDecoder.cs (1)
30Type? enumType = parameterType.IsEnum ? Enum.GetUnderlyingType(parameterType) : null;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (7)
1803Debug.Assert(dataType.IsEnum); 1838Debug.Assert(!dataType.IsEnum); 3052if (p.PropertyType.IsEnum) 3544(dataType.IsEnum && Type.GetTypeCode(dataType.GetEnumUnderlyingType()) <= TypeCode.UInt32)) 5550if (type.IsEnum && Enum.GetUnderlyingType(type) != typeof(ulong) && Enum.GetUnderlyingType(type) != typeof(long)) 5713Debug.Assert(localEnumType.IsEnum); 6035if (type.IsEnum)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\PropertyValue.cs (2)
176if (type.IsEnum) 227if (type.IsEnum)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\Statics.cs (1)
485if (dataType.IsEnum)
src\libraries\System.Private.CoreLib\src\System\Enum.cs (5)
885if (!typeof(TEnum).IsEnum) // with IsEnum being an intrinsic, this whole block will be eliminated for all meaningful cases 1151if (valueType.IsEnum) 1632if (valueType.IsEnum) 1805Debug.Assert(typeof(TEnum).IsEnum); 2212if (valueType.IsEnum)
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (2)
5928if (typeof(T).IsEnum) 5984if (typeof(T).IsEnum)
src\libraries\System.Private.CoreLib\src\System\Reflection\CustomAttributeTypedArgument.cs (2)
42if (ArgumentType.IsEnum) 64result.Append(elementType.IsEnum ? elementType.FullName : elementType.Name);
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBase.cs (1)
158if (argumentType.IsEnum)
src\libraries\System.Private.CoreLib\src\System\Reflection\ModifiedType.cs (1)
172public override bool IsEnum => _unmodifiedType.IsEnum;
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (2)
251if (typeof(T).IsEnum) 313if (typeof(T).IsEnum)
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (2)
2883if (typeof(T).IsEnum) 2947if (typeof(T).IsEnum)
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (3)
437if (typeof(T).IsEnum) 490if (typeof(T).IsEnum) 722Debug.Assert(typeof(T).IsEnum);
src\libraries\System.Private.CoreLib\src\System\Threading\Interlocked.cs (2)
254if (!typeof(T).IsPrimitive && !typeof(T).IsEnum) 506if (!typeof(T).IsPrimitive && !typeof(T).IsEnum)
src\libraries\System.Private.CoreLib\src\System\Type.cs (2)
610if (!IsEnum) 623if (!IsEnum)
src\libraries\System.Private.CoreLib\src\System\Type.Enum.cs (5)
24if (!IsEnum) 31if (valueType.IsEnum) 70if (!IsEnum) 75if (!(valueType.IsEnum || IsIntegerType(valueType))) 92if (!IsEnum)
src\System\Collections\Generic\ComparerHelpers.cs (2)
47else if (type.IsEnum) 84else if (type.IsEnum)
src\System\Reflection\Emit\CustomAttributeBuilder.cs (3)
252if (t.IsEnum) 326else if (type.IsEnum) 373if (type.IsEnum)
src\System\Reflection\Emit\RuntimeTypeBuilder.cs (3)
198if (destType.IsEnum) 964if (IsEnum) 1350if (m_enumUnderlyingType == null && IsEnum)
src\System\Reflection\RuntimeCustomAttributeData.cs (1)
897if (!enumType.IsEnum)
System.Private.DataContractSerialization (11)
System\Runtime\Serialization\ClassDataContract.cs (3)
262SR.Format((declaringType.IsEnum ? SR.DupEnumMemberValue : SR.DupMemberName), 278if (!childType.IsEnum && !Globals.TypeOfIXmlSerializable.IsAssignableFrom(childType) 307if (type.IsEnum)
System\Runtime\Serialization\CodeGenerator.cs (3)
806else if (valueType.IsEnum) 984if (arrayElementType.IsEnum) 1024if (arrayElementType.IsEnum)
System\Runtime\Serialization\DataContract.cs (3)
461else if (type.IsEnum) 667if (type.IsEnum) // Type.GetTypeCode will report Enums as TypeCode.IntXX 1100type.IsEnum ||
System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs (1)
749else if (keyType.IsEnum)
System\Runtime\Serialization\Json\ReflectionJsonFormatReader.cs (1)
169else if (keyType.IsEnum)
System.Private.Windows.Core (5)
System\Private\Windows\BinaryFormat\Deserializer\ClassRecordDeserializer.cs (1)
91bool primitive = type.IsPrimitive || type.IsEnum || type == typeof(string);
System\Private\Windows\BinaryFormat\Support\TypeInfo.cs (1)
52internal static PrimitiveType GetPrimitiveType(Type type) => type.IsEnum ? default : Type.GetTypeCode(type) switch
System\Value.cs (3)
669if (typeof(T).IsEnum) 767else if (typeof(T).IsEnum && _object is TypeFlag<T> typeFlag) 906&& underlyingType.IsEnum
System.Private.Xml (11)
System\Xml\Serialization\CodeGenerator.cs (3)
776else if (valueType.IsEnum) 1032if (arrayElementType.IsEnum) 1080if (arrayElementType.IsEnum)
System\Xml\Serialization\Types.cs (2)
550if (type.IsEnum) 828else if (type.IsEnum)
System\Xml\Serialization\XmlReflectionImporter.cs (1)
1444if (!type!.IsEnum)
System\Xml\Serialization\XmlSerializationReader.cs (1)
1664if (!isPrimitive && !elementType.IsEnum)
System\Xml\Serialization\XmlSerializationWriter.cs (2)
1357bool needXsiType = t != ambientType && !t.IsEnum; 4370if (type.IsEnum)
System\Xml\Xsl\Runtime\XmlExtensionFunction.cs (1)
329if (clrType.IsEnum)
System\Xml\Xsl\Runtime\XsltConvert.cs (1)
368if (clrType.IsEnum) return XmlQueryTypeFactory.DoubleX;
System.Reflection.Context (1)
System\Reflection\Context\Delegation\DelegatingType.cs (1)
79get { return _typeInfo.IsEnum; }
System.Reflection.Emit (3)
System\Reflection\Emit\ModuleBuilderImpl.cs (1)
889if (type.IsEnum)
System\Reflection\Emit\TypeBuilderImpl.cs (2)
257if (_enumUnderlyingType == null && IsEnum) 622if (IsEnum)
System.Reflection.Metadata (3)
System\Reflection\Metadata\BlobWriterImpl.cs (2)
157if (type.GetTypeInfo().IsEnum) 230if (type.GetTypeInfo().IsEnum)
System\Reflection\Metadata\Internal\MetadataWriterUtilities.cs (1)
19Debug.Assert(!value.GetType().GetTypeInfo().IsEnum);
System.Reflection.MetadataLoadContext (1)
System\Reflection\TypeLoading\General\Assignability.cs (1)
255if (t.IsEnum)
System.Resources.Extensions (1)
System\Resources\Extensions\BinaryFormat\Deserializer\ClassRecordDeserializer.cs (1)
92bool primitive = type.IsPrimitive || type.IsEnum || type == typeof(string);
System.Text.Json (7)
src\libraries\System.Text.Json\Common\ReflectionExtensions.cs (2)
306if (parameterType.IsEnum) 311if (Nullable.GetUnderlyingType(parameterType) is Type underlyingType && underlyingType.IsEnum)
System\Text\Json\Nodes\JsonValueOfT.cs (1)
81if (type.IsEnum)
System\Text\Json\Schema\JsonSchemaExporter.cs (1)
197Debug.Assert(elementTypeInfo.Type.IsEnum, "The enum keyword should only be populated by schemas for enum types.");
System\Text\Json\Serialization\Converters\Value\EnumConverterFactory.cs (1)
19return type.IsEnum;
System\Text\Json\Serialization\JsonStringEnumConverter.cs (2)
108return typeToConvert.IsEnum; 114if (!typeToConvert.IsEnum)
System.Windows.Forms (6)
System\Windows\Forms\ActiveX\AxHost.AxPropertyDescriptor.cs (1)
224if (PropertyType.IsEnum && value is not null && value.GetType() != PropertyType)
System\Windows\Forms\ComponentModel\COM2Interop\COM2EnumConverter.cs (2)
20=> base.CanConvertTo(context, destType) || (destType is not null && destType.IsEnum); 34return value is not null && destinationType.IsEnum
System\Windows\Forms\ComponentModel\COM2Interop\Com2IPerPropertyBrowsingHandler.Com2IPerPropertyBrowsingEnum.cs (1)
112if (targetType.IsEnum)
System\Windows\Forms\ComponentModel\COM2Interop\Com2PropertyDescriptor.Com2PropDescMainConverter.cs (1)
40&& !(_propertyDescriptor.PropertyType?.IsEnum ?? false))
System\Windows\Forms\ComponentModel\COM2Interop\COM2PropertyDescriptor.cs (1)
655if (_lastValue is not null && _propertyType is not null && _propertyType.IsEnum && _lastValue.GetType().IsPrimitive)
System.Windows.Forms.Design (1)
System\ComponentModel\Design\Serialization\CodeDomSerializationProvider.cs (1)
74if (objectType.IsPrimitive || objectType.IsEnum || objectType == typeof(string))
System.Windows.Forms.Primitives (1)
System\Windows\Forms\Automation\UiaTextRange.cs (1)
700if (value?.GetType() is { } type && type.IsValueType && !type.IsPrimitive && !type.IsEnum)
System.Xaml (4)
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
335if (type.IsEnum)
System\Windows\Markup\StaticExtension.cs (1)
100if (type.IsEnum)
System\Xaml\Schema\XamlValueConverter.cs (1)
74TargetType.UnderlyingType is not null && TargetType.UnderlyingType.IsEnum)
System\Xaml\XamlType.cs (1)
1254if (underlyingType.IsEnum)
UIAutomationClient (1)
System\Windows\Automation\Text\TextRange.cs (1)
242if (ai.Type.IsEnum && obj is int)
xunit.assert (2)
Sdk\ArgumentFormatter.cs (1)
222 if (value.GetType().GetTypeInfo().IsEnum)
Sdk\AssertHelper.cs (1)
461 if (expectedTypeInfo.IsPrimitive || expectedTypeInfo.IsEnum || expectedType == typeof(string) || expectedType == typeof(decimal) || expectedType == typeof(Guid))