1577 references to Enum
AnalyzerRunner (2)
CodeRefactoringRunner.cs (2)
139if (!Enum.IsDefined(enumType, name)) 144kindBuilder.Add(Convert.ToInt32(Enum.Parse(enumType, name)));
Aspire.Dashboard (9)
Components\Controls\Chart\ChartContainer.razor.cs (1)
275|| !Enum.TryParse(typeof(Pages.Metrics.MetricViewKind), id, out var o)
Components\Pages\Metrics.razor.cs (1)
134viewModel.SelectedViewKind = Enum.TryParse(typeof(MetricViewKind), ViewKindName, out var view) && view is MetricViewKind vk ? vk : null;
Components\Pages\StructuredLogs.razor.cs (1)
400if (LogLevelText is not null && Enum.TryParse<LogLevel>(LogLevelText, ignoreCase: true, out var logLevel))
Model\Otlp\SpanWaterfallViewModel.cs (1)
86if (!string.IsNullOrEmpty(grpcStatusCode) && Enum.TryParse<StatusCode>(grpcStatusCode, out var statusCode))
Model\Otlp\TelemetryFilter.cs (1)
111if (Enum.TryParse<LogLevel>(Value, ignoreCase: true, out var value))
ResourceService\Partials.cs (1)
49KnownState = HasState ? Enum.TryParse(State, out KnownResourceState knownState) ? knownState : null : null,
src\Shared\IConfigurationExtensions.cs (3)
143else if (Enum.TryParse<T>(value, ignoreCase: true, out var e)) 148throw new InvalidOperationException($"Unknown {typeof(T).Name} value \"{value}\". Valid values are {string.Join(", ", Enum.GetNames(typeof(T)))}."); 168throw new InvalidOperationException($"Missing required configuration for {key}. Valid values are {string.Join(", ", Enum.GetNames(typeof(T)))}.");
Aspire.Dashboard.Tests (3)
Model\ResourceStateViewModelTests.cs (2)
12using Enum = System.Enum; 64HealthStatus? healthStatus = string.IsNullOrEmpty(healthStatusString) ? null : Enum.Parse<HealthStatus>(healthStatusString);
Model\ResourceViewModelTests.cs (1)
30var reports = healthStatusStrings?.Select<string?, HealthReportViewModel>((h, i) => new HealthReportViewModel(i.ToString(), h is null ? null : System.Enum.Parse<DiagnosticsHealthStatus>(h), null, null)).ToImmutableArray() ?? [];
Aspire.EndToEnd.Tests (4)
IntegrationServicesFixture.cs (2)
95if (resource == TestResourceNames.All || !Enum.IsDefined<TestResourceNames>(resource)) 120foreach (var ename in Enum.GetValues<TestResourceNames>())
tests\testproject\Common\TestResourceNames.cs (2)
24if (Enum.TryParse<TestResourceNames>(resourceName, ignoreCase: true, out var name)) 39return string.Join(',', Enum.GetValues<TestResourceNames>()
Aspire.Hosting (3)
src\Shared\IConfigurationExtensions.cs (3)
143else if (Enum.TryParse<T>(value, ignoreCase: true, out var e)) 148throw new InvalidOperationException($"Unknown {typeof(T).Name} value \"{value}\". Valid values are {string.Join(", ", Enum.GetNames(typeof(T)))}."); 168throw new InvalidOperationException($"Missing required configuration for {key}. Valid values are {string.Join(", ", Enum.GetNames(typeof(T)))}.");
Aspire.Hosting.Testing.Tests (2)
tests\testproject\Common\TestResourceNames.cs (2)
24if (Enum.TryParse<TestResourceNames>(resourceName, ignoreCase: true, out var name)) 39return string.Join(',', Enum.GetValues<TestResourceNames>()
Aspire.Hosting.Tests (1)
Health\HealthStatusTests.cs (1)
26var reports = healthStatusStrings?.Select<string?, HealthReportSnapshot>((h, i) => new HealthReportSnapshot(i.ToString(), h is null ? null : Enum.Parse<HealthStatus>(h), null, null)).ToImmutableArray() ?? [];
Binding.Http.IntegrationTests (9)
BasicHttpBindingTests.4.0.0.cs (6)
37serviceProxy = factory.CreateChannel(new EndpointAddress(Endpoints.HttpBaseAddress_Basic + Enum.GetName(typeof(WSMessageEncoding), messageEncoding))); 76factory = new ChannelFactory<IWcfService>(customBinding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic + Enum.GetName(typeof(WSMessageEncoding), messageEncoding))); 112factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic + Enum.GetName(typeof(WSMessageEncoding), messageEncoding))); 158factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic + Enum.GetName(typeof(WSMessageEncoding), messageEncoding))); 214factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic + Enum.GetName(typeof(WSMessageEncoding), messageEncoding))); 254factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_Basic + Enum.GetName(typeof(WSMessageEncoding), messageEncoding)));
NetHttpBindingTests.4.0.0.cs (1)
28factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.HttpBaseAddress_NetHttp + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)));
NetHttpsBindingTests.4.1.0.cs (1)
31factory = new ChannelFactory<IWcfService>(netHttpsBinding, new EndpointAddress(Endpoints.HttpBaseAddress_NetHttps + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)));
WSHttpBindingTests.cs (1)
27factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.WSHttpBindingBaseAddress + Enum.GetName(typeof(WSMessageEncoding), messageEncoding)));
Binding.WS.FederationHttp.IntegrationTests (2)
WSFederationHttpBindingTests.cs (2)
38tokenTargetAddress = Endpoints.Https_SecModeTransWithMessCred_ClientCredTypeIssuedTokenSaml2 + endpointSuffix + (useSecureConversation ? "/sc" : string.Empty) + "/" + Enum.GetName(typeof(WSMessageEncoding), encoding); 182foreach (WSMessageEncoding messageEncoding in Enum.GetValues(typeof(WSMessageEncoding)))
CodeStyleConfigFileGenerator (1)
Program.cs (1)
69foreach (var analysisMode in Enum.GetValues(typeof(AnalysisMode)))
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\TypeIndex.cs (1)
86public static string GetGenericTypeDisplayString(CollectionWithCtorInitSpec type, Enum genericProxyTypeName)
ConfigurationSchemaGenerator.Tests (1)
VariousTypes.cs (1)
61/// A value of type <see cref="Enum"/>.
dotnet-dev-certs (1)
Program.cs (1)
388if (exportFormat.HasValue() && !Enum.TryParse(exportFormat.Value(), ignoreCase: true, out format))
dotnet-openapi (4)
Commands\BaseCommand.cs (3)
415codeGenerator = Enum.Parse<CodeGenerator>(codeGeneratorOption.Value()); 430if (!Enum.TryParse(value, out CodeGenerator _)) 485var name = Enum.GetName(typeof(CodeGenerator), generator);
Internal\OpenapiDependencyAttribute.cs (1)
18CodeGenerators = codeGenerators.Split(';', StringSplitOptions.RemoveEmptyEntries).Select(Enum.Parse<CodeGenerator>).ToArray();
dotnet-svcutil-lib (31)
FrameworkFork\Microsoft.Xml\Xml\schema\GenerateConverter.cs (1)
982return (XmlTypeCode)Enum.Parse(typeof(XmlTypeCode), name, true);
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeGenerator.cs (3)
1131Ldc(((IConvertible)o).ToType(Enum.GetUnderlyingType(valueType), null)); 1524Ldelem(Enum.GetUnderlyingType(arrayElementType)); 1605Stelem(Enum.GetUnderlyingType(arrayElementType));
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapReflectionImporter.cs (2)
777string strValue = Enum.Format(a.SoapDefaultValue.GetType(), a.SoapDefaultValue, "G").Replace(",", " "); 778string numValue = Enum.Format(a.SoapDefaultValue.GetType(), a.SoapDefaultValue, "D");
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCodeExporter.cs (1)
912attribute.Arguments.Add(new CodeAttributeArgument("Form", new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(XmlSchemaForm).FullName), Enum.Format(typeof(XmlSchemaForm), form, "G"))));
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlReflectionImporter.cs (2)
2145string strValue = Enum.Format(t, a.XmlDefaultValue, "G").Replace(",", " "); 2146string numValue = Enum.Format(t, a.XmlDefaultValue, "D");
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (5)
225ilg.Ldc(Enum.Parse(mapping.TypeDesc.Type, enumDefaultValue, false)); 649ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type, c.Value)); 2388eValue = Enum.ToObject(choiceMapping.TypeDesc.Type, choiceMapping.Constants[i].Value); 2402eValue = Enum.ToObject(choiceMapping.TypeDesc.Type, choiceMapping.Constants[i].Value); 2494ilg.Ldc(Enum.Parse(type, memberName, false));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeGenerator.cs (3)
981Ldc(Convert.ChangeType(o, Enum.GetUnderlyingType(valueType), null)); 1270Ldelem(Enum.GetUnderlyingType(arrayElementType)); 1333Stelem(Enum.GetUnderlyingType(arrayElementType));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (1)
930else if (type == typeof(Enum) || type == typeof(ValueType))
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\EnumDataContract.cs (3)
194Type baseType = Enum.GetUnderlyingType(type); 422return Enum.ToObject(UnderlyingType, (object)(ulong)longValue); 423return Enum.ToObject(UnderlyingType, (object)longValue);
FrameworkFork\System.ServiceModel\Extensions\ReflectionExtensions.cs (1)
165return GetTypeCode(Enum.GetUnderlyingType(type));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpTransportBindingElement.cs (1)
550if (!Enum.TryParse<TransferMode>(transferMode, true, out result) || !TransferModeHelper.IsDefined(result) || result == TransferMode.Buffered)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SecurityAttributeGenerationHelper.cs (1)
43else if (value is Enum)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WindowsStreamSecurityBindingElement.cs (1)
121windowsBindingElement.ProtectionLevel = (ProtectionLevel)Enum.Parse(typeof(ProtectionLevel), protectionLevelString);
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\OperationGenerator.cs (1)
1028return new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(type), Enum.Format(type, val, "G"));
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\PrincipalPermissionMode.cs (1)
20return Enum.IsDefined(typeof(PrincipalPermissionMode), principalPermissionMode);
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\ServiceContractGenerator.cs (1)
181return new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(EnumType)), Enum.Format(typeof(EnumType), value, "G"));
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (1)
89foreach (var protocol in Enum.GetValues(typeof(SslProtocols)))
HelpGenerator.cs (1)
51ArgumentInfo.CreateParameterHelpInfo(CommandProcessorOptions.Switches.Verbosity.Name, SR.ParametersVerbosity, string.Format(SR.HelpVerbosityFormat, string.Join(", ", System.Enum.GetNames(typeof(Verbosity))), CommandProcessorOptions.Switches.Verbosity.Abbreviation)),
Shared\Options\OptionValueParser.cs (1)
239var supportedValues = string.Format(CultureInfo.CurrentCulture, Shared.Resources.ErrorOnInvalidEnumSupportedValuesFormat, string.Join(", ", Enum.GetNames(typeof(TValue))));
Extensibility.WebSockets.IntegrationTests (10)
WebSocketTests.4.1.0.cs (10)
47endpointAddress = Endpoints.WebSocketHttpDuplexStreamed_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding); 141endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpDuplexBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 209endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpDuplexBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 279endpointAddress = Endpoints.WebSocketHttpsDuplexStreamed_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding); 376endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpsDuplexBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 440endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpRequestReplyStreamed_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 505endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpRequestReplyBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 559endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpRequestReplyBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 615endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpsRequestReplyBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding)); 671endpointAddress = new EndpointAddress(Endpoints.WebSocketHttpsRequestReplyBuffered_Address + Enum.GetName(typeof(NetHttpMessageEncoding), messageEncoding));
GetDocument.Insider (1)
Commands\GetDocumentCommandWorker.cs (1)
337if (Enum.TryParse<OpenApiSpecVersion>(_context.OpenApiVersion, out var version))
IIS.Tests (1)
TlsHandshakeFeatureTests.cs (1)
34Assert.True(Enum.IsDefined(typeof(SslProtocols), protocol), "Defined: " + protocol); // Mapping is required, make sure it's current
illink (5)
ILLink.RoslynAnalyzer (3)
COMAnalyzer.cs (1)
73 if (Enum.IsDefined (typeof (UnmanagedType), unmanagedType))
src\tools\illink\src\ILLink.Shared\Annotations.cs (1)
80 Enum.GetValues (typeof (DynamicallyAccessedMemberTypes))
src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (1)
206 /// <see cref="System.Enum.GetValues(System.Type)"/>
InMemory.FunctionalTests (5)
Http3\Http3ConnectionTests.cs (1)
281var f = Enum.Parse<Http3FrameType>(frameType);
Http3\Http3StreamTests.cs (2)
2099var f = Enum.Parse<Http3FrameType>(frameType); 2130var f = Enum.Parse<Http3FrameType>(frameType);
KestrelMetricsTests.cs (1)
34foreach (var reason in Enum.GetValues<ConnectionEndReason>())
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.Analyzers.Local (4)
ApiLifecycle\Model\Field.cs (1)
20_ = Enum.TryParse<Stage>(enumString, out var stage);
ApiLifecycle\Model\Method.cs (1)
20if (Enum.TryParse<Stage>(enumString, out var stage))
ApiLifecycle\Model\Prop.cs (1)
20_ = Enum.TryParse<Stage>(stageString, out var stage);
ApiLifecycle\Model\TypeDef.cs (1)
24_ = Enum.TryParse<Stage>(value[nameof(Stage)].AsString, out var stage);
Microsoft.Analyzers.Local.Tests (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.AspNetCore.App.Analyzers (1)
RouteEmbeddedLanguage\Infrastructure\EmbeddedLanguageCommentOptions.cs (1)
22internal static class EmbeddedLanguageCommentOptions<TOptions> where TOptions : struct, Enum
Microsoft.AspNetCore.App.Analyzers.Test (1)
Infrastructure\WellKnownTypesTests.cs (1)
117var wellKnownTypeKeys = Enum.GetValues<WellKnownType>();
Microsoft.AspNetCore.AsyncState (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
OpenIdConnectConfigureOptions.cs (2)
102? Enum.Parse<SameSiteMode>(sameSiteMode, ignoreCase: true) 105? Enum.Parse<CookieSecurePolicy>(securePolicy, ignoreCase: true)
Microsoft.AspNetCore.Components (6)
BindConverter.cs (6)
1603private static bool ConvertToEnum<T>(object? obj, CultureInfo? _, out T value) where T : struct, Enum 1612if (!Enum.TryParse<T>(text, out var converted)) 1618if (!Enum.IsDefined(typeof(T), converted)) 1628private static bool ConvertToNullableEnum<T>(object? obj, CultureInfo? _, out T? value) where T : struct, Enum 1637if (!Enum.TryParse<T>(text, out var converted)) 1643if (!Enum.IsDefined(typeof(T), converted))
Microsoft.AspNetCore.Components.Endpoints (2)
FormMapping\Converters\EnumConverter.cs (2)
9internal class EnumConverter<TEnum> : FormDataConverter<TEnum>, ISingleValueConverter<TEnum> where TEnum : struct, Enum 15if (Enum.TryParse(value, ignoreCase: true, out result))
Microsoft.AspNetCore.Components.Web.Tests (2)
Forms\InputRadioTest.cs (2)
78foreach (var selectedValue in (TestEnum[])Enum.GetValues(typeof(TestEnum))) 94foreach (var value in (TestEnum[])Enum.GetValues(typeof(TestEnum)))
Microsoft.AspNetCore.Components.WebView (1)
IpcCommon.cs (1)
45messageType = (T)Enum.Parse(typeof(T), parsed[0].GetString());
Microsoft.AspNetCore.Connections.Abstractions (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
50defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.AspNetCore.DataProtection (2)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (2)
34configuration.EncryptionAlgorithm = (EncryptionAlgorithm)Enum.Parse(typeof(EncryptionAlgorithm), (string)encryptionElement.Attribute("algorithm")!); 40configuration.ValidationAlgorithm = (ValidationAlgorithm)Enum.Parse(typeof(ValidationAlgorithm), (string)validationElement.Attribute("algorithm")!);
Microsoft.AspNetCore.Diagnostics.HealthChecks (1)
HealthCheckOptions.cs (1)
52var missingHealthStatus = Enum.GetValues<HealthStatus>().Except(mapping.Keys).ToList();
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
GrpcJsonSettings.cs (1)
19/// Gets or sets a value that indicates whether <see cref="Enum"/> values are written as integers instead of strings.
Internal\Json\EnumConverter.cs (1)
13internal sealed class EnumConverter<TEnum> : SettingsConverterBase<TEnum> where TEnum : Enum
Microsoft.AspNetCore.HeaderParsing (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.AspNetCore.Http.Abstractions (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
50defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.AspNetCore.Http.Connections.Client (1)
HttpConnection.cs (1)
367if (!Enum.TryParse<HttpTransportType>(transport.Transport, out var transportType))
Microsoft.AspNetCore.Http.Connections.Tests (3)
HttpConnectionDispatcherTests.cs (1)
278var transportType = (HttpTransportType)Enum.Parse(typeof(HttpTransportType), transport.Value<string>("transport"));
WebSocketsTests.cs (2)
49messageType: (WebSocketMessageType)Enum.Parse(typeof(WebSocketMessageType), webSocketMessageType), 105Assert.Equal((WebSocketMessageType)Enum.Parse(typeof(WebSocketMessageType), expectedMessageType), clientSummary.Received[0].MessageType);
Microsoft.AspNetCore.Http.Extensions (6)
src\Components\Endpoints\src\FormMapping\Converters\EnumConverter.cs (2)
9internal class EnumConverter<TEnum> : FormDataConverter<TEnum>, ISingleValueConverter<TEnum> where TEnum : struct, Enum 15if (Enum.TryParse(value, ignoreCase: true, out result))
src\Shared\ParameterBindingMethodCache.cs (4)
510methodInfo = typeof(Enum).GetMethod( 511nameof(Enum.TryParse), 517methodInfo = typeof(Enum).GetMethod( 518nameof(Enum.TryParse),
Microsoft.AspNetCore.Identity.UI (2)
IdentityBuilderUIExtensions.cs (2)
95if (!Enum.TryParse(metadata, ignoreCase: true, out uiFramework)) 97var enumValues = string.Join(", ", Enum.GetNames(typeof(UIFramework)).Select(v => $"'{v}'"));
Microsoft.AspNetCore.JsonPatch (1)
Operations\OperationBase.cs (1)
37if (!Enum.TryParse(value, ignoreCase: true, result: out result))
Microsoft.AspNetCore.Mvc.Abstractions (10)
ModelBinding\ModelMetadata.cs (6)
263/// Gets the ordered and grouped display names and values of all <see cref="Enum"/> values in 268/// <see cref="Enum"/> field groups, names and values. <c>null</c> if <see cref="IsEnum"/> is <c>false</c>. 273/// Gets the names and values of all <see cref="Enum"/> values in <see cref="UnderlyingOrModelType"/>. 276/// An <see cref="IReadOnlyDictionary{String, String}"/> of mappings between <see cref="Enum"/> field names 327/// Gets a value indicating whether <see cref="UnderlyingOrModelType"/> is for an <see cref="Enum"/>. 336/// Gets a value indicating whether <see cref="UnderlyingOrModelType"/> is for an <see cref="Enum"/> with an
src\Shared\ParameterBindingMethodCache.cs (4)
510methodInfo = typeof(Enum).GetMethod( 511nameof(Enum.TryParse), 517methodInfo = typeof(Enum).GetMethod( 518nameof(Enum.TryParse),
Microsoft.AspNetCore.Mvc.Core (10)
ModelBinding\Binders\EnumTypeModelBinder.cs (3)
12/// <see cref="IModelBinder"/> implementation to bind models for types deriving from <see cref="Enum"/>. 82Enum.GetUnderlyingType(modelType), 87return Enum.IsDefined(modelType, model);
ModelBinding\Binders\EnumTypeModelBinderProvider.cs (1)
12/// A <see cref="IModelBinderProvider"/> for types deriving from <see cref="Enum"/>.
ModelBinding\Metadata\DisplayMetadata.cs (4)
141/// Gets the ordered and grouped display names and values of all <see cref="System.Enum"/> values in 148/// Gets the names and values of all <see cref="System.Enum"/> values in 174/// <see cref="System.Enum"/>. See <see cref="ModelMetadata.IsEnum"/>. 181/// <see cref="System.Enum"/> with an associated <see cref="System.FlagsAttribute"/>. See
ModelBinding\ModelBindingHelper.cs (1)
711return Enum.ToObject(destinationType, value);
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
50defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.AspNetCore.Mvc.DataAnnotations (2)
DataAnnotationsMetadataProvider.cs (2)
184var enumFields = Enum.GetNames(underlyingType) 191var value = ((Enum)field.GetValue(obj: null)!).ToString("d");
Microsoft.AspNetCore.Mvc.ViewFeatures (19)
DefaultHtmlGenerator.cs (7)
986var enumValue = value as Enum; 999enumValue = (Enum)methodInfo.Invoke(obj: null, parameters: new[] { stringValue }); 1383private static Enum ConvertEnumFromInteger(object value, Type targetType) 1387return (Enum)Enum.ToObject(targetType, value); 1399if (Enum.TryParse(value, out TEnum enumValue))
HtmlHelper.cs (4)
374nameof(Enum).ToLowerInvariant(), 392nameof(Enum).ToLowerInvariant(), 1365/// Thrown if <paramref name="metadata"/>'s <see cref="ModelMetadata.ModelType"/> is not an <see cref="Enum"/> 1376nameof(Enum).ToLowerInvariant(),
IHtmlGenerator.cs (3)
585/// If the <paramref name="expression"/> result or the element type is an <see cref="System.Enum"/>, returns a 586/// <see cref="string"/> containing the integer representation of the <see cref="System.Enum"/> value as well 587/// as all <see cref="System.Enum"/> names for that value. Otherwise returns the default <see cref="string"/>
Infrastructure\DefaultTempDataSerializer.cs (1)
158case Enum _:
ModelExplorerExtensions.cs (1)
48if (modelExplorer.Metadata.IsEnum && modelExplorer.Model is Enum modelEnum)
Rendering\IHtmlHelper.cs (2)
380/// Thrown if <typeparamref name="TEnum"/> is not an <see cref="Enum"/> or if it has a 394/// Thrown if <paramref name="enumType"/> is not an <see cref="Enum"/> or if it has a
TemplateBuilder.cs (1)
102else if (viewData.ModelMetadata.IsEnum && _model is Enum modelEnum)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
TemplateRendererTest.cs (1)
28{ typeof(Enum), new string[] { "Enum", "String" } },
Microsoft.AspNetCore.OpenApi (4)
src\Shared\ParameterBindingMethodCache.cs (4)
510methodInfo = typeof(Enum).GetMethod( 511nameof(Enum.TryParse), 517methodInfo = typeof(Enum).GetMethod( 518nameof(Enum.TryParse),
Microsoft.AspNetCore.Rewrite (1)
IISUrlRewrite\UrlRewriteFileParser.cs (1)
277else if (!Enum.TryParse(attribute.Value, ignoreCase: true, result: out enumResult))
Microsoft.AspNetCore.Server.HttpSys (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
HttpsTests.cs (1)
166Assert.True(Enum.IsDefined(typeof(SslProtocols), protocol), "Defined: " + protocol); // Mapping is required, make sure it's current
Microsoft.AspNetCore.Server.IIS (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.Kestrel.Core (5)
Internal\Certificates\CertificateConfigLoader.cs (1)
185storeLocation = (StoreLocation)Enum.Parse(typeof(StoreLocation), location, ignoreCase: true);
Internal\ConfigurationReader.cs (3)
168if (Enum.TryParse<ClientCertificateMode>(clientCertificateMode, ignoreCase: true, out var result)) 178if (Enum.TryParse<HttpProtocols>(protocols, ignoreCase: true, out var result)) 202if (Enum.TryParse(current, ignoreCase: true, out SslProtocols parsed))
Internal\ThrowHelper.cs (1)
24Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
src\Shared\Buffers.MemoryPool\MemoryPoolThrowHelper.cs (1)
111Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum.");
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\ParameterDefaultValue\ParameterDefaultValue.cs (1)
50defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.AspNetCore.Testing (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.AspNetCore.WebSockets.ConformanceTests (1)
Autobahn\AutobahnServerResult.cs (1)
27Server = (ServerType)Enum.Parse(typeof(ServerType), splat[0]);
Microsoft.Build (9)
BackEnd\Client\MSBuildClientPacketPump.cs (1)
255NodePacketType packetType = (NodePacketType)Enum.ToObject(typeof(NodePacketType), headerByte[0]);
BackEnd\Components\RequestBuilder\IntrinsicTasks\ItemGroupIntrinsicTask.cs (1)
110Enum.TryParse(child.MatchOnMetadataOptions, out matchOnMetadataOptions);
Evaluation\Expander.cs (3)
4300else if (TryGetArgs(args, out string arg1, out string arg2) && Enum.TryParse<IntrinsicFunctions.StringHashingAlgorithm>(arg2, true, out var hashAlgorithm)) 4891return Enum.TryParse(comparisonTypeName, out arg1); 5384coercedArguments[n] = Enum.Parse(enumType, argument);
Evaluation\IntrinsicFunctions.cs (1)
275RegistryView view = (RegistryView)Enum.Parse(typeof(RegistryView), viewAsString, true);
Evaluation\LazyItemEvaluator.cs (1)
607if (Enum.TryParse(itemElement.MatchOnMetadataOptions, out MatchOnMetadataOptions options))
NodeEndpointOutOfProcBase.cs (1)
596NodePacketType packetType = (NodePacketType)Enum.ToObject(typeof(NodePacketType), headerByte[0]);
Resources\Constants.cs (1)
347availableStaticMethods.TryAdd("System.Enum", new Tuple<string, Type>(null, typeof(Enum)));
Microsoft.Build.Engine.UnitTests (5)
BuildEventArgsSerialization_Tests.cs (2)
524(AssemblyLoadingContext)(new Random().Next(Enum.GetNames(typeof(AssemblyLoadingContext)).Length)); 1051BinaryLogRecordKind unknownType = (BinaryLogRecordKind)Enum.GetValues(typeof(BinaryLogRecordKind)).Cast<BinaryLogRecordKind>().Select(e => (int)e).Max() + 2;
Evaluation\Expander_Tests.cs (1)
3950=> Enum.GetNames(typeof(IntrinsicFunctions.StringHashingAlgorithm))
ProjectCache\ProjectCacheTests.cs (1)
1648foreach (var enumValue in Enum.GetValues(typeof(ErrorLocations)))
Scanner_Tests.cs (1)
57ParserOptions options = (ParserOptions)Enum.Parse(typeof(ParserOptions), tests[i, 2], true /* case-insensitive */);
Microsoft.Build.Framework (5)
BinaryTranslator.cs (3)
489where T : struct, Enum 493value = (T)Enum.ToObject(enumType, numericValue); 1188where T : struct, Enum
ITranslator.cs (1)
256where T : struct, Enum;
Polyfills\StringSyntaxAttribute.cs (1)
43/// <summary>The syntax identifier for strings containing <see cref="Enum"/> format specifiers.</summary>
Microsoft.Build.Framework.UnitTests (1)
AssemblyLoadBuildEventArgs_Tests.cs (1)
22(AssemblyLoadingContext)(new Random().Next(Enum.GetNames(typeof(AssemblyLoadingContext)).Length));
Microsoft.Build.Tasks.Core (19)
AssemblyDependency\ResolveAssemblyReference.cs (1)
255if (!Enum.TryParse<WarnOrErrorOnTargetArchitectureMismatchBehavior>(value, /*ignoreCase*/true, out _warnOrErrorOnTargetArchitectureMismatch))
FileIO\GetFileHash.cs (1)
139=> Enum.TryParse<HashEncoding>(value, /*ignoreCase:*/ true, out encoding);
FormatVersion.cs (1)
72_formatType = (_FormatType)Enum.Parse(typeof(_FormatType), FormatType, true);
GenerateApplicationManifest.cs (1)
340_manifestType = (_ManifestType)Enum.Parse(typeof(_ManifestType), ManifestType, true);
GenerateDeploymentManifest.cs (2)
276_updateMode = (UpdateMode)Enum.Parse(typeof(UpdateMode), UpdateMode, true); 293_updateUnit = (UpdateUnit)Enum.Parse(typeof(UpdateUnit), UpdateUnit, true);
GenerateManifestBase.cs (2)
369return (AssemblyType)Enum.Parse(typeof(AssemblyType), value, true); 400return (DependencyType)Enum.Parse(typeof(DependencyType), value, true);
ManifestUtil\DeployManifest.cs (2)
527try { return (UpdateMode)Enum.Parse(typeof(UpdateMode), _updateMode, true); } 543try { return (UpdateUnit)Enum.Parse(typeof(UpdateUnit), _updateUnit, true); }
Message.cs (1)
61messageImportance = (MessageImportance)Enum.Parse(typeof(MessageImportance), Importance, true /* case-insensitive */);
MSBuildInternalMessage.cs (2)
57if (Enum.TryParse(Severity, ignoreCase: true, out BuildMessageSeverity severity)) 70MessageImportance importance = (MessageImportance)Enum.Parse(typeof(MessageImportance), MessageImportance, true);
ResolveManifestFiles.cs (1)
996return (PublishState)Enum.Parse(typeof(PublishState), value, false);
ResolveSDKReference.cs (2)
1122Enum.TryParse<SDKType>(sdkTypeFromMetadata, out SDKType sdkType); 1161return !String.IsNullOrEmpty(multipleVersionsValue) && Enum.TryParse<MultipleVersionSupport>(multipleVersionsValue, /*ignoreCase*/true, out _supportsMultipleVersions);
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (2)
456if (!Enum.TryParse(typeAttribute.Value.Trim(), ignoreCase: true, result: out RoslynCodeTaskFactoryCodeType codeType)) 458log.LogErrorWithCodeFromResources("CodeTaskFactory.InvalidCodeType", typeAttribute.Value, String.Join(", ", Enum.GetNames(typeof(RoslynCodeTaskFactoryCodeType))));
Touch.cs (1)
144if (!Enum.TryParse(Importance, ignoreCase: true, out messageImportance))
Microsoft.Build.Tasks.UnitTests (2)
RoslynCodeTaskFactory_Tests.cs (2)
287foreach (RoslynCodeTaskFactoryCodeType codeType in Enum.GetValues(typeof(RoslynCodeTaskFactoryCodeType)).Cast<RoslynCodeTaskFactoryCodeType>()) 299foreach (RoslynCodeTaskFactoryCodeType codeType in Enum.GetValues(typeof(RoslynCodeTaskFactoryCodeType)).Cast<RoslynCodeTaskFactoryCodeType>())
Microsoft.Build.Utilities.Core (4)
SDKManifest.cs (2)
430Enum.TryParse(value, out _sdkType); 459=> !string.IsNullOrEmpty(multipleVersionsValue) && Enum.TryParse(multipleVersionsValue, /*ignoreCase*/true, out MultipleVersionSupport supportsMultipleVersions)
ToolTask.cs (2)
1277_standardErrorImportanceToUse = (MessageImportance)Enum.Parse(typeof(MessageImportance), StandardErrorImportance, true /* case-insensitive */); 1297_standardOutputImportanceToUse = (MessageImportance)Enum.Parse(typeof(MessageImportance), StandardOutputImportance, true /* case-insensitive */);
Microsoft.Cci.Extensions (2)
Differs\Differences.cs (2)
32Enum en = obj as Enum;
Microsoft.CodeAnalysis (7)
InternalUtilities\EnumUtilties.cs (3)
16return (T[])Enum.GetValues(typeof(T)); 20internal static bool ContainsAllValues<T>(int mask) where T : struct, Enum, IConvertible 33internal static bool ContainsValue<T>(T value) where T : struct, Enum
InternalUtilities\JsonWriter.cs (3)
109public void Write<T>(string key, T value) where T : struct, Enum 195public void Write<T>(T value) where T : struct, Enum 200public void Write<T>(T? value) where T : struct, Enum
SpecialType.cs (1)
36/// Indicates that the type is <see cref="Enum"/>.
Microsoft.CodeAnalysis.CodeStyle (24)
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
23where TSyntaxKind : struct, Enum
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
24where TSyntaxKind : struct, Enum
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (1)
31foreach (TargetScope targetScope in Enum.GetValues(typeof(TargetScope)))
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
32where TSyntaxKind : struct, Enum
src\Compilers\Core\Portable\InternalUtilities\EnumUtilties.cs (3)
16return (T[])Enum.GetValues(typeof(T)); 20internal static bool ContainsAllValues<T>(int mask) where T : struct, Enum, IConvertible 33internal static bool ContainsValue<T>(T value) where T : struct, Enum
src\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs (1)
259if (Enum.TryParse(value, out Modifiers mods))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
188var severity = (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), severityAttribute.Value);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
479capitalizationScheme: (Capitalization)Enum.Parse(typeof(Capitalization), namingStyleElement.Attribute(nameof(CapitalizationScheme)).Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
46EnforcementLevel = ((DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), namingRuleElement.Attribute(nameof(EnforcementLevel))!.Value)).ToReportDiagnostic(),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (5)
315=> (Accessibility)Enum.Parse(typeof(Accessibility), accessibilityElement.Value); 426var symbolKind = (SymbolKind)Enum.Parse(typeof(SymbolKind), symbolKindElement.Value); 438=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441=> new((MethodKind)Enum.Parse(typeof(MethodKind), methodKindElement.Value)); 541=> new((ModifierKindEnum)Enum.Parse(typeof(ModifierKindEnum), modifierElement.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer.cs (7)
102public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>() where T : struct, Enum 110public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>(BidirectionalMap<string, T> map) where T : struct, Enum 117public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>(BidirectionalMap<string, T> map, ImmutableDictionary<string, T> alternative) where T : struct, Enum 125public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>(IEnumerable<(string name, T value)> entries, IEnumerable<(string name, T value)> alternativeEntries) where T : struct, Enum 134public static EditorConfigValueSerializer<T?> CreateSerializerForNullableEnum<T>() where T : struct, Enum 156private static bool TryParseEnum<T>(string str, out T result) where T : struct, Enum 171return Enum.TryParse(str, ignoreCase: true, out result);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Simplification\SpecialTypeAnnotation.cs (1)
27=> (SpecialType)Enum.Parse(typeof(SpecialType), arg);
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
124symbol.Name == nameof(Enum.HasFlag) &&
Microsoft.CodeAnalysis.CSharp (9)
CommandLine\CSharpCompiler.cs (1)
287foreach (var v in (LanguageVersion[])Enum.GetValues(typeof(LanguageVersion)))
Compilation\CSharpCompilerDiagnosticAnalyzer.cs (1)
23var errorCodes = Enum.GetValues(typeof(ErrorCode));
SymbolDisplay\ObjectDisplay.cs (1)
51type = Enum.GetUnderlyingType(type);
Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1174Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
101if (!Enum.TryParse(operationLocationString, out UseUtf8StringLiteralDiagnosticAnalyzer.ArrayCreationOperationLocation operationLocation))
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (3)
CommandLineTests.cs (3)
1734Enum.GetValues(typeof(LanguageVersion)).Cast<LanguageVersion>().Select(v => v.ToDisplayString())); 1741var versions = Enum.GetValues(typeof(LanguageVersion)) 1880var expected = Enum.GetValues(typeof(LanguageVersion)).Cast<LanguageVersion>()
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Completion\CompletionProviders\ExtensionMethodImportCompletionProviderTests.cs (1)
44foreach (var refKind in Enum.GetValues(typeof(ReferenceType)))
LanguageServer\CSharpLspBuildOnlyDiagnosticsTests.cs (1)
24var errorCodes = Enum.GetValues(typeof(ErrorCode));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (5)
Attributes\AttributeTests_Synthesized.cs (3)
39foreach (var level in Enum.GetValues(typeof(OptimizationLevel))) 50foreach (var kind in Enum.GetValues(typeof(OutputKind))) 52foreach (var level in Enum.GetValues(typeof(OptimizationLevel)))
Diagnostics\DiagnosticAnalyzerTests.cs (1)
728var missingResource = Enum.GetName(typeof(ErrorCode), id) + "_Title";
Diagnostics\DiagnosticSuppressorTests.cs (1)
327var severities = Enum.GetValues(typeof(DiagnosticSeverity));
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider (7)
src\Compilers\CSharp\Portable\SymbolDisplay\ObjectDisplay.cs (1)
51type = Enum.GetUnderlyingType(type);
src\Compilers\CSharp\Portable\Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1174Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
Microsoft.CodeAnalysis.CSharp.Features (1)
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
101if (!Enum.TryParse(operationLocationString, out UseUtf8StringLiteralDiagnosticAnalyzer.ArrayCreationOperationLocation operationLocation))
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (1)
154var errorCodes = Enum.GetValues(typeof(ErrorCode));
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (1)
95foreach (var kind in Enum.GetValues(typeof(SyntaxKind)).Cast<SyntaxKind>().Where(hasLabel))
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (2)
CommandLineRunnerTests.cs (1)
769var expected = Enum.GetValues(typeof(LanguageVersion)).Cast<LanguageVersion>()
InteractiveSessionTests.cs (1)
246Assert.Equal(typeof(int), Enum.GetUnderlyingType(e.GetType()));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (7)
Semantics\NullableReferenceTypesTests.cs (5)
125110foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic))) 125293foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic))) 126078foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic))) 126834private static readonly NullableAnnotation[] s_AllNullableAnnotations = ((NullableAnnotation[])Enum.GetValues(typeof(NullableAnnotation))).Where(n => n != NullableAnnotation.Ignored).ToArray(); 126835private static readonly NullableFlowState[] s_AllNullableFlowStates = (NullableFlowState[])Enum.GetValues(typeof(NullableFlowState));
SourceGeneration\GeneratorDriverTests.cs (2)
3104foreach (IncrementalGeneratorOutputKind kind in Enum.GetValues(typeof(IncrementalGeneratorOutputKind))) 3132bool isTextForKind(GeneratedSourceResult s) => s.HintName == Enum.GetName(typeof(IncrementalGeneratorOutputKind), kind) + ".cs";
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (5)
Compilation\CSharpCompilationOptionsTests.cs (1)
456var values = (NullableContextOptions[])System.Enum.GetValues(typeof(NullableContextOptions));
Compilation\GetUnusedImportDirectivesTests.cs (1)
485foreach (DocumentationMode documentationMode in Enum.GetValues(typeof(DocumentationMode)))
Symbols\MissingSpecialMember.cs (2)
552foreach (SpecialMember special in Enum.GetValues(typeof(SpecialMember))) 940foreach (WellKnownMember wkm in Enum.GetValues(typeof(WellKnownMember)))
Symbols\Source\ClsComplianceTests.cs (1)
3158foreach (SpecialType st in Enum.GetValues(typeof(SpecialType)))
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (11)
Diagnostics\DiagnosticTest.cs (6)
39foreach (ErrorCode code in Enum.GetValues(typeof(ErrorCode))) 56var values = Enum.GetValues(typeof(ErrorCode)); 214foreach (ErrorCode errorCode in Enum.GetValues(typeof(ErrorCode))) 247foreach (ErrorCode errorCode in Enum.GetValues(typeof(ErrorCode))) 495foreach (ErrorCode error in Enum.GetValues(typeof(ErrorCode))) 2934foreach (ErrorCode errorCode in Enum.GetValues(typeof(ErrorCode)))
Parsing\AsyncParsingTests.cs (1)
31foreach (LanguageVersion version in Enum.GetValues(typeof(LanguageVersion)))
Parsing\LanguageVersionTests.cs (1)
18var highest = Enum.
Syntax\SyntaxTests.cs (3)
259foreach (var kind in (SyntaxKind[])Enum.GetValues(typeof(SyntaxKind))) 292Assert.True(Enum.IsDefined(typeof(SyntaxKind), kind), $"Nonexistent kind '{kind}' returned from method '{method.Name}'"); 314if (Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i))
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (1)
Metadata\WinMdEventTests.cs (1)
2912foreach (OutputKind kind in Enum.GetValues(typeof(OutputKind)))
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Workspace\LanguageServices\CSharpCompilationFactoryService.cs (1)
48!Enum.TryParse<OutputKind>(outputKindString, out var outputKind))
Microsoft.CodeAnalysis.EditorFeatures (6)
EditorConfigSettings\Data\CodeStyleSetting.cs (2)
100where T : Enum 114where T : Enum
EditorConfigSettings\Data\EnumFlagsSetting.cs (1)
20where TOptionValue : struct, Enum
EditorConfigSettings\Data\Setting.cs (1)
74where TValue : struct, Enum
InlineRename\InlineRenameSession.cs (1)
398m["Kind"] = Enum.GetName(typeof(WorkspaceChangeKind), args.Kind);
Logging\FunctionIdOptions.cs (1)
38=> Enum.GetValues(typeof(FunctionId)).Cast<FunctionId>();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
EditorConfigSettings\Data\CodeStyleSettingsTest.cs (3)
69enumValues: (DayOfWeek[])Enum.GetValues(typeof(DayOfWeek)), 70valueDescriptions: Enum.GetNames(typeof(DayOfWeek))); 91where T : notnull, Enum
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (7)
src\Compilers\Core\Portable\SpecialType.cs (1)
36/// Indicates that the type is <see cref="Enum"/>.
src\Compilers\CSharp\Portable\Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1174Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
ResultProviderTestBase.cs (1)
481private static string FormatEnumValue(Enum e)
Microsoft.CodeAnalysis.ExternalAccess.FSharp.UnitTests (6)
FSharpGlyphTests.cs (2)
19foreach (var number in Enum.GetValues(typeof(FSharpGlyph))) 27foreach (var number in Enum.GetValues(typeof(Glyph)))
FSharpHighlightSpanKindTests.cs (1)
21foreach (var number in Enum.GetValues(typeof(FSharpHighlightSpanKind)))
FSharpInlineRenameReplacementKindTests.cs (1)
21foreach (var number in Enum.GetValues(typeof(FSharpInlineRenameReplacementKind)))
FSharpNavigateToMatchKindTests.cs (1)
21foreach (var number in Enum.GetValues(typeof(FSharpNavigateToMatchKind)))
FSharpSignatureHelpTriggerReasonTests.cs (1)
21foreach (var number in Enum.GetValues(typeof(SignatureHelpTriggerReason)))
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.UnitTests (4)
EnumTests.cs (4)
28var internalValues = Enum.GetValues(internalType).Cast<int>().ToArray(); 29var internalNames = Enum.GetNames(internalType); 30var externalValues = Enum.GetValues(externalType).Cast<int>().ToArray(); 31var externalNames = Enum.GetNames(externalType);
Microsoft.CodeAnalysis.Features (13)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
123foreach (var enumValue in Enum.GetValues(t))
EmbeddedLanguages\AbstractLanguageDetector.cs (2)
20where TOptions : struct, Enum 177where TOptions : struct, Enum
EmbeddedLanguages\EmbeddedLanguageCommentOptions.cs (1)
21internal static class EmbeddedLanguageCommentOptions<TOptions> where TOptions : struct, Enum
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
31Debug.Assert(Enum.GetNames(typeof(TriviaLocation)).Length == TriviaLocationsCount);
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (1)
26where TSyntaxKind : struct, Enum
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (2)
250Debug.Assert(Enum.GetUnderlyingType(typeof(DeclaredSymbolInfoKind)) == typeof(byte)); 252var lookupTable = new bool[Enum.GetValues(typeof(DeclaredSymbolInfoKind)).Length];
QuickInfo\Presentation\QuickInfoContentBuilder.cs (1)
21var glyphs = (Glyph[])Enum.GetValues(typeof(Glyph));
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
23where TSyntaxKind : struct, Enum
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
24where TSyntaxKind : struct, Enum
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (1)
31foreach (TargetScope targetScope in Enum.GetValues(typeof(TargetScope)))
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
32where TSyntaxKind : struct, Enum
Microsoft.CodeAnalysis.Features.UnitTests (4)
EditAndContinue\EditAndContinueCapabilitiesTests.cs (2)
59foreach (var name in Enum.GetNames(typeof(EditAndContinueCapabilities))) 65var flag = (EditAndContinueCapabilities)Enum.Parse(typeof(EditAndContinueCapabilities), name);
EditAndContinue\RudeEditDiagnosticTests.cs (1)
74var allKinds = Enum.GetValues(typeof(RudeEditKind)).Cast<RudeEditKind>();
FindUsages\DefinitionItemFactoryTests.cs (1)
35private static string InspectFlags<TEnum>(TEnum e) where TEnum : Enum
Microsoft.CodeAnalysis.LanguageServer (2)
LanguageServer\Handler\Logging\UpdateLogLevelHandler.cs (1)
29var level = Enum.Parse<LogLevel>(request.LogLevelValue);
Logging\RoslynLogger.cs (1)
231=> Enum.GetName(typeof(FunctionId), id)!.Replace('_', separator).ToLowerInvariant();
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Extensions\ProtocolConversions.cs (2)
528if (Enum.TryParse<LSP.SymbolKind>(kind, out var symbolKind)) 633if (Enum.TryParse<LSP.SymbolKind>(glyphString, out var symbolKind))
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (2)
Configuration\DidChangeConfigurationNotificationHandlerTest.cs (2)
297null => Enum.GetValues(type).GetValue(0), 308foreach (var value in Enum.GetValues(type))
Microsoft.CodeAnalysis.Rebuild (3)
CompilationFactory.cs (1)
211: (Platform)Enum.Parse(typeof(Platform), platform);
CSharpCompilationFactory.cs (1)
84: (NullableContextOptions)Enum.Parse(typeof(NullableContextOptions), nullable);
MetadataCompilationOptions.cs (1)
64public static T? ToEnum<T>(string value) where T : struct => Enum.TryParse<T>(value, out var enumValue) ? enumValue : null;
Microsoft.CodeAnalysis.Rebuild.UnitTests (2)
CSharpDeterministicKeyBuilderTests.cs (1)
276foreach (BinderFlags binderFlags in Enum.GetValues(typeof(BinderFlags)))
OptionRoundTripTests.cs (1)
33public static readonly object[][] Platforms = ((Platform[])Enum.GetValues(typeof(Platform))).Select(p => new[] { (object)p }).ToArray();
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
src\VisualStudio\Core\Def\Telemetry\Shared\TelemetryLogger.cs (1)
94=> Enum.GetName(typeof(FunctionId), id)!.Replace('_', separator).ToLowerInvariant();
Microsoft.CodeAnalysis.Test.Utilities (2)
Diagnostics\DiagnosticDescription.cs (1)
392sb.Append(Enum.GetName(_errorCodeType, _code));
Diagnostics\TestDiagnosticAnalyzer.cs (1)
30return ImmutableArray.CreateRange(Enum.GetValues(typeof(T)).Cast<T>());
Microsoft.CodeAnalysis.UnitTests (5)
Collections\List\ICollection.NonGeneric.Tests.cs (1)
238Array enumArr = Enum.GetValues(typeof(EnumerableType));
Collections\List\TestBase.Generic.cs (1)
51((IEnumerable<EnumerableType>)Enum.GetValues(typeof(EnumerableType))).SelectMany(GetEnumerableTestData);
CommonSyntaxTests.cs (2)
22foreach (CS.SyntaxKind kind in Enum.GetValues(typeof(CS.SyntaxKind))) 32foreach (VB.SyntaxKind kind in Enum.GetValues(typeof(VB.SyntaxKind)))
MetadataReferences\MetadataHelpersTests.cs (1)
85foreach (ArrayKind arrayKind in Enum.GetValues(typeof(ArrayKind)))
Microsoft.CodeAnalysis.VisualBasic (1)
CommandLine\VisualBasicCompiler.vb (1)
240For Each v As LanguageVersion In System.Enum.GetValues(GetType(LanguageVersion))
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (2)
CommandLineTests.vb (2)
2061System.Enum.GetValues(GetType(LanguageVersion)).Cast(Of LanguageVersion)().Select(Function(v) v.ToDisplayString())) 2067Dim versions = System.Enum.GetValues(GetType(LanguageVersion)).
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (2)
Parser\LanguageVersionTests.vb (1)
8Dim highest = System.Enum.
Parser\VisualBasicParseOptionsTests.vb (1)
83Dim highest = System.Enum.
Microsoft.CodeAnalysis.Workspaces (27)
CodeCleanup\AbstractCodeCleanerService.cs (1)
670var types = annotation.Data.Split(s_separators).Select(s => (SpanMarkerType)Enum.Parse(typeof(SpanMarkerType), s)).ToArray();
CodeFixes\ExportCodeFixProviderAttribute.cs (1)
21private static readonly string[] s_documentKindNames = Enum.GetNames(typeof(TextDocumentKind));
CodeFixesAndRefactorings\EnumArrayConverter.cs (2)
12public static ImmutableArray<TEnum> FromStringArray<TEnum>(string[] strings) where TEnum : struct, Enum 18if (!Enum.TryParse(s, out TEnum enumValue))
CodeRefactorings\ExportCodeRefactoringProviderAttribute.cs (1)
20private static readonly string[] s_documentKindNames = Enum.GetNames(typeof(TextDocumentKind));
Editing\DeclarationModifiers.cs (1)
259if (Enum.TryParse(value, out Modifiers mods))
Log\FunctionIdExtensions.cs (1)
14() => Enum.GetValues(typeof(FunctionId)).Cast<FunctionId>().ToImmutableDictionary(f => f, f => f.ToString()));
src\Compilers\Core\Portable\InternalUtilities\EnumUtilties.cs (3)
16return (T[])Enum.GetValues(typeof(T)); 20internal static bool ContainsAllValues<T>(int mask) where T : struct, Enum, IConvertible 33internal static bool ContainsValue<T>(T value) where T : struct, Enum
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
188var severity = (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), severityAttribute.Value);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
479capitalizationScheme: (Capitalization)Enum.Parse(typeof(Capitalization), namingStyleElement.Attribute(nameof(CapitalizationScheme)).Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
46EnforcementLevel = ((DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), namingRuleElement.Attribute(nameof(EnforcementLevel))!.Value)).ToReportDiagnostic(),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (5)
315=> (Accessibility)Enum.Parse(typeof(Accessibility), accessibilityElement.Value); 426var symbolKind = (SymbolKind)Enum.Parse(typeof(SymbolKind), symbolKindElement.Value); 438=> new((TypeKind)Enum.Parse(typeof(TypeKind), typeKindElement.Value)); 441=> new((MethodKind)Enum.Parse(typeof(MethodKind), methodKindElement.Value)); 541=> new((ModifierKindEnum)Enum.Parse(typeof(ModifierKindEnum), modifierElement.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer.cs (7)
102public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>() where T : struct, Enum 110public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>(BidirectionalMap<string, T> map) where T : struct, Enum 117public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>(BidirectionalMap<string, T> map, ImmutableDictionary<string, T> alternative) where T : struct, Enum 125public static EditorConfigValueSerializer<T> CreateSerializerForEnum<T>(IEnumerable<(string name, T value)> entries, IEnumerable<(string name, T value)> alternativeEntries) where T : struct, Enum 134public static EditorConfigValueSerializer<T?> CreateSerializerForNullableEnum<T>() where T : struct, Enum 156private static bool TryParseEnum<T>(string str, out T result) where T : struct, Enum 171return Enum.TryParse(str, ignoreCase: true, out result);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Simplification\SpecialTypeAnnotation.cs (1)
27=> (SpecialType)Enum.Parse(typeof(SpecialType), arg);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
124symbol.Name == nameof(Enum.HasFlag) &&
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (7)
MSBuild\ProjectFile\Conversions.cs (1)
62return Enum.TryParse<TEnum>(value, ignoreCase, out var result)
src\Compilers\Core\Portable\InternalUtilities\EnumUtilties.cs (3)
16return (T[])Enum.GetValues(typeof(T)); 20internal static bool ContainsAllValues<T>(int mask) where T : struct, Enum, IConvertible 33internal static bool ContainsValue<T>(T value) where T : struct, Enum
src\Compilers\Core\Portable\InternalUtilities\JsonWriter.cs (3)
109public void Write<T>(string key, T value) where T : struct, Enum 195public void Write<T>(T value) where T : struct, Enum 200public void Write<T>(T? value) where T : struct, Enum
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
VisualStudioMSBuildWorkspaceTests.cs (2)
2246Enum.GetName(typeof(WorkspaceChangeKind), expectedEventKind), 2282Enum.GetName(typeof(WorkspaceChangeKind), expectedEventKind),
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (8)
Options\OptionsTestHelpers.cs (3)
124_ when Nullable.GetUnderlyingType(type) is { IsEnum: true } underlying => value is null ? Enum.ToObject(underlying, 1) : null, 146var zero = Enum.ToObject(type, 0); 147return defaultValue.Equals(zero) ? Enum.ToObject(type, 1) : zero;
Workspaces\TestWorkspace_XmlConsumption.cs (5)
333return (DocumentationMode)Enum.Parse(typeof(DocumentationMode), documentationModeAttribute.Value); 432outputKind = (OutputKind)Enum.Parse(typeof(OutputKind), outputKindAttribute.Value); 450reportDiagnostic = (ReportDiagnostic)Enum.Parse(typeof(ReportDiagnostic), (string)reportDiagnosticAttribute); 485nullable = (NullableContextOptions)Enum.Parse(typeof(NullableContextOptions), nullableAttribute.Value); 624: (SourceCodeKind)Enum.Parse(typeof(SourceCodeKind), attr.Value);
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
FindAllDeclarationsTests.TestSolutionsAndProject.cs (2)
40Enum.GetName(typeof(SolutionKind), workspaceKind))); 55Enum.GetName(typeof(SolutionKind), workspaceKind)));
FunctionIdTests.cs (2)
20foreach (var name in Enum.GetNames(typeof(FunctionId))) 22var value = (FunctionId)Enum.Parse(typeof(FunctionId), name);
Host\LanguageServices\TestCSharpCompilationFactoryServiceWithIncrementalGeneratorTracking.cs (1)
50!Enum.TryParse<OutputKind>(outputKindString, out var outputKind))
ObjectSerializationTests.cs (1)
96? (T)Enum.ToObject(typeof(T), r.ReadInt64())
Microsoft.CSharp (6)
Microsoft\CSharp\RuntimeBinder\Semantics\Operators.cs (3)
1049Debug.Assert(Enum.IsDefined(bt1)); 1050Debug.Assert(Enum.IsDefined(bt2)); 1553Debug.Assert(Enum.IsDefined(bt));
Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Constant.cs (1)
78return Type.IsEnumType ? Enum.ToObject(Type.AssociatedSystemType, objval) : objval;
Microsoft\CSharp\RuntimeBinder\Semantics\Types\PredefinedTypes.cs (1)
150new PredefinedTypeInfo(PredefinedType.PT_ENUM, typeof(Enum), "System.Enum"),
Microsoft\CSharp\RuntimeBinder\SymbolTable.cs (1)
860agg.SetUnderlyingType((AggregateType)GetCTypeFromType(Enum.GetUnderlyingType(type)));
Microsoft.DotNet.Arcade.Sdk (1)
src\SetCorFlags.cs (1)
63if (Enum.TryParse<CorFlags>(value, out var result))
Microsoft.DotNet.ArcadeLogging (1)
PipelinesLogger.cs (1)
38Verbosity = !string.IsNullOrEmpty(verbosityString) && Enum.TryParse(verbosityString, out LoggerVerbosity verbosity)
Microsoft.DotNet.Build.Tasks.Feed (5)
src\Common\Internal\EnumExtensions.cs (2)
14public static string GetDescription(this Enum value) 17string name = Enum.GetName(type, value);
src\GenerateBuildManifest.cs (1)
126if (!Enum.TryParse(PublishingVersion, ignoreCase: true, out targetPublishingVersion))
src\PushToBuildStorage.cs (2)
232if (!Enum.TryParse(PublishingVersion, ignoreCase: true, out targetPublishingVersion)) 341return allowedVisibilities.Select(item => (ArtifactVisibility)Enum.Parse(typeof(ArtifactVisibility), item.ItemSpec)).ToArray();
Microsoft.DotNet.Build.Tasks.Feed.Tests (2)
GeneralTests.cs (1)
31foreach (TargetFeedContentType type in Enum.GetValues(typeof(TargetFeedContentType)))
PublishToSymbolServerTest.cs (1)
83IEnumerable<SymbolPublishVisibility> visibilities = Enum.GetValues<SymbolPublishVisibility>().Where(x => x <= maxVisibility);
Microsoft.DotNet.Build.Tasks.Installers (4)
src\RpmBuilder.cs (2)
207entries.Add(new((RpmHeaderTag)Enum.Parse(typeof(RpmHeaderTag), script.Key), RpmHeaderEntryType.String, "/bin/sh")); 208entries.Add(new((RpmHeaderTag)Enum.Parse(typeof(RpmHeaderTag), $"{script.Key}prog"), RpmHeaderEntryType.String, script.Value));
src\RpmHeader.cs (2)
18where TEntryTag : struct, Enum 33: this((TEntryTag)Enum.ToObject(typeof(TEntryTag), entryTag), type, value)
Microsoft.DotNet.Build.Tasks.Packaging (2)
Extensions.cs (1)
70Enum.TryParse(packageDirectoryName, true, out result);
ValidationTask.cs (1)
116if (!Enum.TryParse<Suppression>(keyString, out key))
Microsoft.DotNet.GenAPI (3)
GenAPITask.cs (3)
72set => _writerType = string.IsNullOrWhiteSpace(value) ? default : (WriterType) Enum.Parse(typeof(WriterType), value, true); 81set => _syntaxWriterType = string.IsNullOrWhiteSpace(value) ? default : (SyntaxWriterType)Enum.Parse(typeof(SyntaxWriterType), value, true); 90set => _docIdKinds = string.IsNullOrWhiteSpace(value) ? Cci.Writers.DocIdKinds.All : (DocIdKinds)Enum.Parse(typeof(DocIdKinds), value, true);
Microsoft.DotNet.Helix.Client (1)
generated-code\HelixApi.cs (1)
226if (value is Enum)
Microsoft.DotNet.Internal.SymbolHelper (1)
SymbolPromotionHelper.cs (1)
84if (!Enum.IsDefined(visibility))
Microsoft.DotNet.SignCheck (2)
SignCheck.cs (1)
146if (Enum.TryParse<FileStatus>(value, out result))
SignCheckTask.cs (1)
145if(Enum.TryParse<LogVerbosity>(Verbosity, out LogVerbosity verbosity))
Microsoft.DotNet.VersionTools (3)
BuildManifest\Model\BlobArtifactModel.cs (1)
55else if (Enum.TryParse(val, out ArtifactVisibility visibility))
BuildManifest\Model\BuildIdentity.cs (1)
128return (PublishingInfraVersion)Enum.Parse(typeof(PublishingInfraVersion), value, true);
BuildManifest\Model\PackageArtifactModel.cs (1)
67else if (Enum.TryParse(val, out ArtifactVisibility visibility))
Microsoft.DotNet.VersionTools.Tasks (3)
SubmitPullRequest.cs (2)
134if (!Enum.TryParse(PullRequestServiceType, true, out type)) 136string options = string.Join(", ", Enum.GetNames(typeof(PullRequestServiceType)));
TraceListenerCollectionExtensions.cs (1)
29MsBuildTraceListener[] listeners = Enum.GetValues(typeof(TraceEventType))
Microsoft.DotNet.VersionTools.Tests (2)
BuildManifest\ManifestModelTests.cs (2)
588Assert.Equal(visibility is "" ? ArtifactVisibility.External : (ArtifactVisibility)Enum.Parse(typeof(ArtifactVisibility), visibility), packageArtifact.Visibility); 694Assert.Equal(visibility is "" ? ArtifactVisibility.External : (ArtifactVisibility)Enum.Parse(typeof(ArtifactVisibility), visibility), blobArtifact.Visibility);
Microsoft.Extensions.AmbientMetadata.Application (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.AsyncState (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Caching.Hybrid (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 227if (!Enum.IsDefined(typeof(T), argument))
Microsoft.Extensions.Compliance.Abstractions (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 227if (!Enum.IsDefined(typeof(T), argument))
Microsoft.Extensions.Compliance.Redaction (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Compliance.Testing (3)
src\LegacySupport\StringSyntaxAttribute\StringSyntaxAttribute.cs (1)
48/// <summary>The syntax identifier for strings containing <see cref="Enum"/> format specifiers.</summary>
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 227if (!Enum.IsDefined(typeof(T), argument))
Microsoft.Extensions.Configuration.Binder (2)
ConfigurationBinder.cs (1)
728object key = keyTypeIsEnum ? Enum.Parse(keyType, child.Key, true) :
src\libraries\Common\src\Extensions\ParameterDefaultValue\ParameterDefaultValue.cs (1)
55defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.Extensions.DependencyInjection (1)
src\libraries\Common\src\Extensions\ParameterDefaultValue\ParameterDefaultValue.cs (1)
55defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.Extensions.DependencyInjection.Abstractions (1)
src\libraries\Common\src\Extensions\ParameterDefaultValue\ParameterDefaultValue.cs (1)
55defaultValue = Enum.ToObject(underlyingType, defaultValue);
Microsoft.Extensions.DependencyInjection.AutoActivation (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Diagnostics.ExceptionSummarization (4)
HttpExceptionSummaryProvider.cs (2)
42foreach (var v in Enum.GetValues(typeof(SocketError))) 57foreach (var v in Enum.GetValues(typeof(WebExceptionStatus)))
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 227if (!Enum.IsDefined(typeof(T), argument))
Microsoft.Extensions.Diagnostics.HealthChecks.Common (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Diagnostics.Probes (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Diagnostics.ResourceMonitoring (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Diagnostics.Testing (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Hosting.Testing (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Http (2)
DependencyInjection\SocketsHttpHandlerBuilderExtensions.cs (2)
55/// Only simple (of type `bool`, `int`, <see cref="Enum"/> or <see cref="TimeSpan"/>) properties of <see cref="SocketsHttpHandler"/> will be parsed. 218=> Enum.TryParse<TEnum>(enumString, ignoreCase: true, out var result) ? result : null;
Microsoft.Extensions.Http.Resilience (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Logging.Configuration (1)
LoggerFilterConfigureOptions.cs (1)
79else if (Enum.TryParse(value, true, out level))
Microsoft.Extensions.Logging.Console (1)
ConfigurationConsoleLoggerSettings.cs (1)
92else if (Enum.TryParse<LogLevel>(value, true, out level))
Microsoft.Extensions.ObjectPool.DependencyInjection (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Options.Contextual (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Primitives (2)
ThrowHelper.cs (2)
61Debug.Assert(Enum.IsDefined(typeof(ExceptionResource), resource), 79Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument),
Microsoft.Extensions.Resilience (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 227if (!Enum.IsDefined(typeof(T), argument))
Microsoft.Extensions.Telemetry (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.Telemetry.Abstractions (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Extensions.TimeProvider.Testing (2)
src\Shared\Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
Microsoft.Interop.ComInterfaceGenerator (1)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (1)
177return !Enum.IsDefined(typeof(UnmanagedType), unmanagedType)
Microsoft.Interop.JavaScript.JSImportGenerator (3)
JSMarshalAsAttributeInfoParser.cs (3)
33Enum.TryParse(name, out jsType); 39Enum.TryParse(argName, out jsTypeArg); 47Enum.TryParse(name, out jsType);
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\ConvertToLibraryImportAnalyzer.cs (1)
206return !Enum.IsDefined(typeof(UnmanagedType), unmanagedType)
Analyzers\ConvertToLibraryImportFixer.cs (1)
80CharSet? charSet = options.TryGetValue(CharSetOption, out Option charSetOption) && charSetOption is Option.String(string charSetString) && Enum.TryParse<CharSet>(charSetString, out CharSet result) ? result : null;
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
690|| !Enum.IsDefined(typeof(MarshalMode), (MarshalMode)marshalMode))
LibraryImportGenerator.cs (1)
532static ExpressionSyntax CreateEnumExpressionSyntax<T>(T value) where T : Enum
Microsoft.Interop.SourceGeneration (1)
MarshalAsParser.cs (1)
158if (!Enum.IsDefined(typeof(UnmanagedType), unmanagedType)
Microsoft.Maui (8)
Converters\FlexEnumsConverters.cs (6)
24 if (Enum.TryParse(strValue, true, out FlexJustify justify)) 63 if (Enum.TryParse(strValue, true, out FlexDirection aligncontent)) 98 if (Enum.TryParse(strValue, true, out FlexAlignContent aligncontent)) 137 if (Enum.TryParse(strValue, true, out FlexAlignItems alignitems)) 172 if (Enum.TryParse(strValue, true, out FlexAlignSelf alignself)) 207 if (Enum.TryParse(strValue, true, out FlexWrap wrap))
Fonts\FontManager.iOS.cs (1)
141 if (!string.IsNullOrWhiteSpace(fontWeight) && Enum.TryParse<UIFontWeight>(fontWeight, true, out var uIFontWeight))
Platform\iOS\MenuExtensions.cs (1)
110 if (Enum.TryParse(typeof(UIMenuIdentifier), title, out object? result))
Microsoft.Maui.Controls (14)
Button\Button.cs (1)
602 position = (ButtonContentLayout.ImagePosition)Enum.Parse(typeof(ButtonContentLayout.ImagePosition), parts[positionIndex], true);
CompareStateTrigger.cs (3)
74 if (value2 is Enum) 86 return Enum.IsDefined(enumType, value) ? Enum.ToObject(enumType, value) : null;
DecorableTextElement.cs (1)
38 if (Enum.TryParse(item.Trim(), true, out TextDecorations textDecorations))
FlowDirectionConverter.cs (1)
22 if (Enum.TryParse(strValue, out FlowDirection direction))
FontAttributes.cs (1)
56 if (Enum.TryParse(part, true, out FontAttributes attr))
FontSizeConverter.cs (2)
52 else if (Enum.TryParse(value, ignoreCase, out NamedSize ns)) 96 if (Enum.TryParse(strValue, out NamedSize namedSize))
ListView\ListView.cs (2)
389 if (!Enum.IsDefined(typeof(ScrollToPosition), position)) 404 if (!Enum.IsDefined(typeof(ScrollToPosition), position))
ScrollView\ScrollView.cs (1)
261 if (!Enum.IsDefined(typeof(ScrollToPosition), position))
TextAlignment.cs (1)
38 if (Enum.TryParse(strValue, out TextAlignment direction))
Xaml\TypeConversionExtensions.cs (1)
173 return Enum.Parse(toType, str, ignoreCase);
Microsoft.Maui.Controls.Build.Tasks (3)
CompiledConverters\EnumTypeConverter.cs (1)
16 if (Enum.TryParse(value, out TEnum enumValue))
CompiledConverters\FontSizeTypeConverter.cs (1)
26 if (Enum.TryParse(value, out NamedSize namedSize))
SetPropertiesVisitor.cs (1)
438 || !Enum.TryParse((modeNode as ValueNode)?.Value as string, true, out BindingMode declaredmode))
Microsoft.Maui.Controls.DesignTools (2)
ButtonContentDesignTypeConverter.cs (2)
34 if (parts.Length == 2 && !Enum.TryParse(parts[1], true, out ImagePosition _)) 40 if (!Enum.TryParse(parts[0], true, out ImagePosition _))
Microsoft.Maui.Graphics (2)
Text\TextAttributesExtensions.cs (1)
135 if (Enum.TryParse(value, out T enumValue))
Text\XmlAttributedTextReader.cs (1)
126 if (Enum.TryParse(attributeName, out TextAttribute key))
Microsoft.ML.AutoML (10)
API\BinaryClassificationExperiment.cs (1)
50Trainers = Enum.GetValues(typeof(BinaryClassificationTrainer)).OfType<BinaryClassificationTrainer>().ToList();
API\MulticlassClassificationExperiment.cs (1)
45Trainers = Enum.GetValues(typeof(MulticlassClassificationTrainer)).OfType<MulticlassClassificationTrainer>().ToList();
API\RankingExperiment.cs (1)
44Trainers = Enum.GetValues(typeof(RankingTrainer)).OfType<RankingTrainer>().ToList();
API\RecommendationExperiment.cs (1)
35Trainers = Enum.GetValues(typeof(RecommendationTrainer)).OfType<RecommendationTrainer>().ToList();
API\RegressionExperiment.cs (1)
45Trainers = Enum.GetValues(typeof(RegressionTrainer)).OfType<RegressionTrainer>().ToList();
ColumnInference\ColumnGroupingInference.cs (1)
124return Enum.GetName(typeof(ColumnPurpose), purpose);
Experiment\SuggestedPipeline.cs (2)
86var trainerName = (TrainerName)Enum.Parse(typeof(TrainerName), pipelineNode.Name); 95var estimatorName = (EstimatorName)Enum.Parse(typeof(EstimatorName), pipelineNode.Name);
TrainerExtensions\TrainerExtensionUtil.cs (1)
283.ToDictionary(v => Enum.GetName(fi.FieldType, v), v => v);
Utils\SweepableParamAttributes.cs (1)
93case Enum _:
Microsoft.ML.AutoML.Tests (7)
EstimatorExtensionTests.cs (1)
32var estimatorNames = Enum.GetValues(typeof(EstimatorName)).Cast<EstimatorName>();
TrainerExtensionsTests.cs (6)
27var trainerNames = Enum.GetValues(typeof(TrainerName)).Cast<TrainerName>() 357var publicNames = Enum.GetValues(typeof(BinaryClassificationTrainer)).Cast<BinaryClassificationTrainer>(); 365var publicNames = Enum.GetValues(typeof(MulticlassClassificationTrainer)).Cast<MulticlassClassificationTrainer>(); 373var publicNames = Enum.GetValues(typeof(RegressionTrainer)).Cast<RegressionTrainer>(); 381var publicNames = Enum.GetValues(typeof(RecommendationTrainer)).Cast<RecommendationTrainer>(); 389var publicNames = Enum.GetValues(typeof(RankingTrainer)).Cast<RankingTrainer>();
Microsoft.ML.CodeGenerator (3)
CodeGenerator\CSharp\TrainerGeneratorFactory.cs (1)
22if (Enum.TryParse(node.Name, out TrainerName trainer))
CodeGenerator\CSharp\TransformGeneratorFactory.cs (2)
31if (Enum.TryParse(node.Name, out EstimatorName trainer)) 84if (Enum.TryParse(node.Name, out SpecialTransformer transformer))
Microsoft.ML.Core (4)
CommandLine\CmdParser.cs (1)
1893value = Enum.Parse(type, data, true);
EntryPoints\ModuleArgs.cs (1)
373case Enum _:
Utilities\Utils.cs (2)
1246public static string GetDescription(this Enum value) 1249string name = Enum.GetName(type, value);
Microsoft.ML.Core.Tests (1)
UnitTests\TestVBuffer.cs (1)
1099Contracts.Assert(cases == Enum.GetValues(typeof(GenLogic)).Length);
Microsoft.ML.Data (22)
Commands\TrainCommand.cs (1)
449ch.CheckUserArg(Enum.IsDefined(typeof(NormalizeOption), autoNorm), nameof(TrainCommand.Arguments.NormalizeFeatures),
Commands\TypeInfoCommand.cs (1)
87var kinds = Enum.GetValues(typeof(InternalDataKind)).Cast<InternalDataKind>().Distinct().OrderBy(k => k).ToArray();
DataLoadSave\Binary\BinaryLoader.cs (5)
344bool knowCompression = Enum.IsDefined(typeof(CompressionKind), compression); 503ectx.Assert(Enum.IsDefined(typeof(CompressionKind), compression)); 530Contracts.Assert((codec == null) || !Enum.IsDefined(typeof(CompressionKind), compression)); 1110bool knowCompression = Enum.IsDefined(typeof(CompressionKind), compression); 1779Ectx.Assert(Enum.IsDefined(typeof(CompressionKind), entry.Compression));
DataLoadSave\Database\DatabaseLoader.cs (2)
499ch.CheckUserArg(Enum.IsDefined(typeof(DbType), col.Type), nameof(Column.Type), "Bad item type"); 570Contracts.CheckDecode(Enum.IsDefined(typeof(InternalDataKind), kind));
DataLoadSave\Text\TextLoader.cs (2)
777ch.CheckUserArg(Enum.IsDefined(typeof(InternalDataKind), kind), nameof(Column.Type), "Bad item type"); 935Contracts.CheckDecode(Enum.IsDefined(typeof(InternalDataKind), kind));
EntryPoints\InputBuilder.cs (2)
446if (!Enum.IsDefined(type, value.Value<string>())) 448return Enum.Parse(type, value.Value<string>());
Model\Pfa\SavePfaCommand.cs (1)
82Host.CheckUserArg(Enum.IsDefined(typeof(Formatting), args.Formatting), nameof(args.Formatting), "Undefined value");
Transforms\ColumnSelecting.cs (2)
345Contracts.Assert(Enum.IsDefined(typeof(HiddenColumnOption), hiddenOption)); 361Contracts.Assert(Enum.IsDefined(typeof(HiddenColumnOption), colHiddenOption));
Transforms\TypeConverting.cs (2)
266Host.CheckDecode(Enum.IsDefined(typeof(InternalDataKind), kind)); 416ectx.Assert(Enum.IsDefined(typeof(InternalDataKind), kind));
Transforms\ValueToKeyMappingTransformer.cs (2)
283if (!Enum.IsDefined(typeof(ValueToKeyMappingEstimator.KeyOrdinality), options.Sort)) 290if (!Enum.IsDefined(typeof(ValueToKeyMappingEstimator.KeyOrdinality), sortOrder))
Transforms\ValueToKeyMappingTransformerImpl.cs (1)
519ectx.CheckDecode(Enum.IsDefined(typeof(MapType), mtype));
Utilities\TypeParsingUtils.cs (1)
46if (!Enum.TryParse(str, true, out dataKind))
Microsoft.ML.Ensemble (9)
OutputCombiners\MultiWeightedAverage.cs (3)
59Host.CheckUserArg(Enum.IsDefined(typeof(MultiWeightageKind), _weightageKind), nameof(options.WeightageName)); 69Host.CheckDecode(Enum.IsDefined(typeof(MultiWeightageKind), _weightageKind)); 87Host.Assert(Enum.IsDefined(typeof(MultiWeightageKind), _weightageKind));
OutputCombiners\WeightedAverage.cs (3)
57Host.CheckUserArg(Enum.IsDefined(typeof(WeightageKind), _weightageKind), nameof(options.WeightageName)); 66Host.CheckDecode(Enum.IsDefined(typeof(WeightageKind), _weightageKind)); 85Contracts.Assert(Enum.IsDefined(typeof(WeightageKind), _weightageKind));
Selector\SubModelSelector\BestPerformanceRegressionSelector.cs (1)
41Host.CheckUserArg(Enum.IsDefined(typeof(RegressionEvaluator.Metrics), args.MetricName), nameof(args.MetricName), "Undefined metric name");
Selector\SubModelSelector\BestPerformanceSelector.cs (1)
40Host.CheckUserArg(Enum.IsDefined(typeof(BinaryClassifierEvaluator.Metrics), args.MetricName),
Selector\SubModelSelector\BestPerformanceSelectorMulticlass.cs (1)
40Host.CheckUserArg(Enum.IsDefined(typeof(MulticlassClassificationEvaluator.Metrics), args.MetricName),
Microsoft.ML.EntryPoints (1)
JsonUtils\JsonManifestUtils.cs (1)
365var values = Enum.GetNames(type).Where(n => type.GetField(n).GetCustomAttribute<HideEnumValueAttribute>() == null);
Microsoft.ML.FastTree (9)
Dataset\IntArray.cs (2)
91Contracts.CheckParam(Enum.IsDefined(typeof(IntArrayType), type) && type != IntArrayType.Current, nameof(type)); 92Contracts.CheckParam(Enum.IsDefined(typeof(IntArrayBits), bitsPerItem), nameof(bitsPerItem));
SumupPerformanceCommand.cs (1)
89_host.CheckUserArg(Enum.IsDefined(typeof(IntArrayType), args.Type) && args.Type != IntArrayType.Current, nameof(args.Type), "Value not defined");
Utils\Timer.cs (6)
131TickTotals = new long[Enum.GetValues(typeof(TimerEvent)).Length]; 132CountTotals = new long[Enum.GetValues(typeof(CountEvent)).Length]; 136foreach (string name in Enum.GetNames(typeof(TimerEvent))) 141foreach (string name in Enum.GetNames(typeof(CountEvent))) 160foreach (TimerEvent n in Enum.GetValues(typeof(TimerEvent))) 175foreach (CountEvent n in Enum.GetValues(typeof(CountEvent)))
Microsoft.ML.ImageAnalytics (4)
ImageResizer.cs (4)
207Host.CheckDecode(Enum.IsDefined(typeof(ImageResizingEstimator.ResizingKind), scale)); 209Host.CheckDecode(Enum.IsDefined(typeof(ImageResizingEstimator.Anchor), anchor)); 456Contracts.CheckUserArg(Enum.IsDefined(typeof(ResizingKind), resizing), nameof(resizing)); 457Contracts.CheckUserArg(Enum.IsDefined(typeof(Anchor), anchor), nameof(anchor));
Microsoft.ML.InternalCodeAnalyzer (2)
NameFixProvider.cs (2)
56if (!Enum.TryParse(desiredNameStr, out desiredName)) 94Debug.Assert(!Enum.IsDefined(typeof(NameType), desiredName));
Microsoft.ML.SearchSpace (5)
Parameter.cs (5)
135/// Create a <see cref="Parameter"/> from a <see cref="Enum"/> value. The <see cref="ParameterType"/> will be <see cref="ParameterType.String"/>. 138public static Parameter FromEnum<T>(T value) where T : struct, Enum 158private static Parameter FromEnum(Enum e, Type t) 160return Parameter.FromString(Enum.GetName(t, e)); 183Enum e => Parameter.FromEnum(e, e.GetType()),
Microsoft.ML.Tests (1)
ExpressionLanguageTests\ExpressionLanguageTests.cs (1)
233bool tmp = Enum.TryParse(toks[i], out kind);
Microsoft.ML.TimeSeries (16)
SequentialAnomalyDetectionTransformBase.cs (9)
173Host.CheckUserArg(Enum.IsDefined(typeof(MartingaleType), martingale), nameof(ArgumentsBase.Martingale), "Value is undefined."); 174Host.CheckUserArg(Enum.IsDefined(typeof(AnomalySide), anomalySide), nameof(ArgumentsBase.Side), "Value is undefined."); 175Host.CheckUserArg(Enum.IsDefined(typeof(AlertingScore), alertingScore), nameof(ArgumentsBase.AlertOn), "Value is undefined."); 211Host.CheckDecode(Enum.IsDefined(typeof(MartingaleType), temp)); 215Host.CheckDecode(Enum.IsDefined(typeof(AlertingScore), temp)); 222Host.CheckDecode(Enum.IsDefined(typeof(AnomalySide), temp)); 240Host.Assert(Enum.IsDefined(typeof(MartingaleType), Martingale)); 241Host.Assert(Enum.IsDefined(typeof(AlertingScore), ThresholdScore)); 244Host.Assert(Enum.IsDefined(typeof(AnomalySide), Side));
SlidingWindowTransformBase.cs (3)
74Host.CheckUserArg(Enum.IsDefined(typeof(BeginOptions), args.Begin), nameof(args.Begin), "Undefined value."); 92Host.CheckDecode(Enum.IsDefined(typeof(BeginOptions), r)); 114Host.Assert(Enum.IsDefined(typeof(BeginOptions), _begin));
SsaAnomalyDetectionBase.cs (3)
196Host.CheckUserArg(Enum.IsDefined(typeof(ErrorFunction), options.ErrorFunction), nameof(options.ErrorFunction), ErrorFunctionUtils.ErrorFunctionHelpText); 233Host.CheckDecode(Enum.IsDefined(typeof(ErrorFunction), temp)); 272Host.Assert(Enum.IsDefined(typeof(ErrorFunction), ErrorFunction));
SsaChangePointDetector.cs (1)
143InternalTransform.Host.Assert(!Enum.IsDefined(typeof(MartingaleType), InternalTransform.Martingale));
Microsoft.ML.Transforms (17)
GcnTransform.cs (1)
846Contracts.CheckDecode(Enum.IsDefined(typeof(NormFunction), normKindVal));
MissingValueReplacing.cs (1)
441if (!Enum.IsDefined(typeof(ReplacementKind), kind))
OneHotEncoding.cs (2)
53if (!Enum.TryParse(extra, true, out OneHotEncodingEstimator.OutputKind kind)) 65if (!Enum.IsDefined(typeof(OneHotEncodingEstimator.OutputKind), kind))
Text\NgramTransform.cs (2)
160Contracts.CheckDecode(Enum.IsDefined(typeof(NgramExtractingEstimator.WeightingCriteria), Weighting)); 179Contracts.Assert(Enum.IsDefined(typeof(NgramExtractingEstimator.WeightingCriteria), Weighting));
Text\StopWordsRemovingTransformer.cs (4)
149var values = Enum.GetValues(typeof(StopWordsRemovingEstimator.Language)).Cast<int>(); 171var langsDictionary = Enum.GetValues(typeof(StopWordsRemovingEstimator.Language)).Cast<StopWordsRemovingEstimator.Language>() 237Contracts.CheckDecode(Enum.IsDefined(typeof(StopWordsRemovingEstimator.Language), lang)); 294foreach (StopWordsRemovingEstimator.Language lang in Enum.GetValues(typeof(StopWordsRemovingEstimator.Language)))
Text\TextFeaturizingEstimator.cs (3)
314=> (StopWordsRemovingEstimator.Language)Enum.Parse(typeof(StopWordsRemovingEstimator.Language), Language.ToString()); 379host.Check(Enum.IsDefined(typeof(Language), parent.OptionalSettings.Language)); 380host.Check(Enum.IsDefined(typeof(CaseMode), parent.OptionalSettings.CaseMode));
Text\TextNormalizing.cs (1)
164host.CheckDecode(Enum.IsDefined(typeof(TextNormalizingEstimator.CaseMode), _caseMode));
Text\WordEmbeddingsExtractor.cs (2)
187env.CheckUserArg(Enum.IsDefined(typeof(WordEmbeddingEstimator.PretrainedModelKind), modelKind), nameof(modelKind)); 227env.CheckUserArg(!options.ModelKind.HasValue || Enum.IsDefined(typeof(WordEmbeddingEstimator.PretrainedModelKind), options.ModelKind), nameof(options.ModelKind));
UngroupTransform.cs (1)
355ectx.CheckDecode(Enum.IsDefined(typeof(UngroupMode), modeIndex));
Microsoft.VisualBasic.Core (14)
Microsoft\VisualBasic\CompilerServices\Conversions.vb (8)
2372If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2377If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2382If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2387If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2392If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2397If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2402If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression) 2407If IsEnum(TargetType) Then Return [Enum].ToObject(TargetType, Expression)
Microsoft\VisualBasic\FileIO\FileSystem.vb (6)
895Debug.Assert([Enum].IsDefined(operation), "Invalid Operation") 964Debug.Assert([Enum].IsDefined(operation), "Invalid Operation") 1013Debug.Assert([Enum].IsDefined(Operation), "Invalid Operation") 1095Debug.Assert([Enum].IsDefined(operation), "Invalid Operation") 1600Debug.Assert([Enum].IsDefined(Operation)) 1601Debug.Assert([Enum].IsDefined(TargetType))
Microsoft.VisualStudio.LanguageServices (7)
EditorConfigSettings\Common\EnumSettingViewModel.cs (1)
12where T : Enum
Options\LocalUserRegistryOptionPersister.cs (2)
104value = Enum.ToObject(optionKey.Option.Type, value); 153if (Marshal.SizeOf(Enum.GetUnderlyingType(optionType)) > Marshal.SizeOf(typeof(int)))
Options\VisualStudioSettingsOptionPersister.cs (3)
108return manager.TryGetValue(storageKey, out int value) == GetValueResult.Success ? Enum.ToObject(storageType, value) : default(Optional<object?>); 115return nullableValue.HasValue ? Enum.ToObject(underlyingType, nullableValue.Value) : null; 119return Enum.ToObject(underlyingType, value);
Telemetry\Shared\TelemetryLogger.cs (1)
94=> Enum.GetName(typeof(FunctionId), id)!.Replace('_', separator).ToLowerInvariant();
Microsoft.VisualStudio.LanguageServices.CSharp (1)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
126if (!Enum.TryParse(GetStringOption(CompilerOptions.OPTID_PLATFORM, ""), ignoreCase: true, result: out Platform platform))
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
UnifiedSettings\CSharpUnifiedSettingsTests.cs (1)
41var allValues = Enum.GetValues(option.Type).Cast<object>();
Microsoft.VisualStudio.LanguageServices.DevKit (1)
src\VisualStudio\Core\Def\Telemetry\Shared\TelemetryLogger.cs (1)
94=> Enum.GetName(typeof(FunctionId), id)!.Replace('_', separator).ToLowerInvariant();
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
ProjectSystemShim\VisualBasicProject.OptionsProcessor.vb (1)
60If Not System.Enum.TryParse(compilerOptions.wszPlatformType, ignoreCase:=True, result:=platform) Then
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
192Debug.Fail($"Unhandled {nameof(XamlCompletionKind)}: {Enum.GetName(typeof(XamlCompletionKind), kind)}");
MSBuild (2)
MSBuildClientApp.cs (1)
91Enum.TryParse(exitResult.MSBuildAppExitTypeString, out MSBuildApp.ExitType MSBuildAppExitType))
NodeEndpointOutOfProcBase.cs (1)
596NodePacketType packetType = (NodePacketType)Enum.ToObject(typeof(NodePacketType), headerByte[0]);
MSBuildTaskHost (5)
BinaryTranslator.cs (3)
489where T : struct, Enum 493value = (T)Enum.ToObject(enumType, numericValue); 1188where T : struct, Enum
ITranslator.cs (1)
256where T : struct, Enum;
NodeEndpointOutOfProcBase.cs (1)
596NodePacketType packetType = (NodePacketType)Enum.ToObject(typeof(NodePacketType), headerByte[0]);
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
222[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Enum))]
netstandard (1)
netstandard.cs (1)
780[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Enum))]
PresentationBuildTasks (2)
Microsoft\Build\Tasks\Windows\UidManager.cs (1)
84_task = (UidTask)Enum.Parse(typeof(UidTask), _taskAsString);
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\SystemResourceKey.cs (1)
409Enum.TryParse(srkField, out SystemResourceKeyID srkId))
PresentationCore (10)
MS\Internal\FontFace\CompositeFontParser.cs (1)
333if (Enum.TryParse(_reader.GetAttribute("OS"), out fontFamilyOsVersion)
System\Windows\Input\Command\MouseActionConverter.cs (1)
105/// Helper function similar to <see cref="Enum.IsDefined{MouseAction}(MouseAction)"/>, just lighter and faster.
System\Windows\Input\Cursor.cs (1)
333return Enum.GetName(_cursorType);
System\Windows\Input\CursorConverter.cs (1)
107CursorType ct = Enum.Parse<CursorType>(text);
System\Windows\Input\InputScopeConverter.cs (2)
119sn = Enum.Parse<InputScopeNameValue>(spanSource); 155return Enum.GetName(((InputScopeName)inputScope.Names[0]).NameValue);
System\Windows\Input\InputScopeNameConverter.cs (2)
102nameValue = Enum.Parse<InputScopeNameValue>(stringSource); 137return Enum.GetName(inputScopeName.NameValue);
System\Windows\Media\Knowncolors.cs (1)
175KnownColor[] knownColorValues = Enum.GetValues<KnownColor>();
System\Windows\Media\RequestCachePolicyConverter.cs (1)
76HttpRequestCacheLevel level = Enum.Parse<HttpRequestCacheLevel>(s, true);
PresentationFramework (15)
MS\Internal\Controls\StickyNote\StickyNoteAnnotations.cs (1)
71foreach (XmlToken val in Enum.GetValues<XmlToken>())
System\Windows\Controls\DataGridColumn.cs (1)
1164comboBoxColumn.ItemsSource = Enum.GetValues(propertyType);
System\Windows\Documents\FixedElement.cs (1)
158return string.Create(CultureInfo.InvariantCulture, $"{{S@{_start}---E@{_end}}} {System.Enum.GetName(_type)}");
System\Windows\Documents\FlowNode.cs (1)
179return $"Pg{page}-nCp{_fp}-Id{_scopeId}-Tp{System.Enum.GetName(_type)}";
System\Windows\Documents\Tracing\SpellerCOMActionTraceLogger.cs (1)
158foreach (Actions a in Enum.GetValues<Actions>())
System\Windows\Markup\Baml2006\Baml2006Reader.cs (1)
2516return Enum.ToObject(type.UnderlyingType, bytes).ToString();
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (1)
11598typeof(System.Enum),
System\Windows\Markup\BamlReader.cs (1)
2440if (Enum.IsDefined(keyId))
System\Windows\Markup\BamlRecords.cs (1)
2748_valueObject = Enum.ToObject(propertyType, enumBits);
System\Windows\Markup\Primitives\ElementMarkupObject.cs (2)
928Enum enumValue = value as Enum;
System\Windows\SystemKeyConverter.cs (3)
253return $"{Enum.GetName(id)}Key"; 263string propName = $"{Enum.GetName(id)}Key"; 275return Enum.GetName(id);
System\Windows\SystemResourceKey.cs (1)
409Enum.TryParse(srkField, out SystemResourceKeyID srkId))
PresentationUI (5)
MS\Internal\Documents\RightsManagementResourceHelper.cs (2)
114RightsManagementStatus[] statusList = Enum.GetValues<RightsManagementStatus>(); 136+ Enum.GetName(status)
MS\Internal\Documents\RMPublishingDialog.RightsTable.cs (1)
598return (RightsTableColumn)Enum.ToObject(typeof(RightsTableColumn), index);
MS\Internal\Documents\SignatureResourceHelper.cs (2)
141SignatureStatus[] statusList = Enum.GetValues<SignatureStatus>(); 163+ Enum.GetName(sigStatus)
ReachFramework (36)
PrintConfig\PrintSchema.cs (34)
1985internal static string[] CollationNames = Enum.GetNames(typeof(Collation)); 1986internal static int[] CollationEnums = (int[])(Array)Enum.GetValues<Collation>(); 1995internal static string[] DuplexNames = Enum.GetNames(typeof(Duplexing)); 1996internal static int[] DuplexEnums = (int[])(Array)Enum.GetValues<Duplexing>(); 2007internal static string[] DirectionNames = Enum.GetNames(typeof(PagesPerSheetDirection)); 2008internal static int[] DirectionEnums = (int[])(Array)Enum.GetValues<PagesPerSheetDirection>(); 2017internal static string[] StaplingNames = Enum.GetNames(typeof(Stapling)); 2018internal static int[] StaplingEnums = (int[])(Array)Enum.GetValues<Stapling>(); 2027internal static string[] SubstitutionNames = Enum.GetNames(typeof(DeviceFontSubstitution)); 2028internal static int[] SubstitutionEnums = (int[])(Array)Enum.GetValues<DeviceFontSubstitution>(); 2046internal static string[] MediaSizeNames = Enum.GetNames(typeof(PageMediaSizeName)); 2047internal static int[] MediaSizeEnums = (int[])(Array)Enum.GetValues<PageMediaSizeName>(); 2072internal static string[] MediaTypeNames = Enum.GetNames(typeof(PageMediaType)); 2073internal static int[] MediaTypeEnums = (int[])(Array)Enum.GetValues<PageMediaType>(); 2082internal static string[] OrientationNames = Enum.GetNames(typeof(PageOrientation)); 2083internal static int[] OrientationEnums = (int[])(Array)Enum.GetValues<PageOrientation>(); 2092internal static string[] ColorNames = Enum.GetNames(typeof(OutputColor)); 2093internal static int[] ColorEnums = (int[])(Array)Enum.GetValues<OutputColor>(); 2105internal static string[] QualityNames = Enum.GetNames(typeof(PageQualitativeResolution)); 2106internal static int[] QualityEnums = (int[])(Array)Enum.GetValues<PageQualitativeResolution>(); 2118internal static string[] ScalingNames = Enum.GetNames(typeof(PageScaling)); 2119internal static int[] ScalingEnums = (int[])(Array)Enum.GetValues<PageScaling>(); 2128internal static string[] ModeNames = Enum.GetNames(typeof(TrueTypeFontMode)); 2129internal static int[] ModeEnums = (int[])(Array)Enum.GetValues<TrueTypeFontMode>(); 2138internal static string[] PageOrderNames = Enum.GetNames(typeof(PageOrder)); 2139internal static int[] PageOrderEnums = (int[])(Array)Enum.GetValues<PageOrder>(); 2148internal static string[] PhotoIntentNames = Enum.GetNames(typeof(PhotoPrintingIntent)); 2149internal static int[] PhotoIntentEnums = (int[])(Array)Enum.GetValues<PhotoPrintingIntent>(); 2158internal static string[] BorderlessNames = Enum.GetNames(typeof(PageBorderless)); 2159internal static int[] BorderlessEnums = (int[])(Array)Enum.GetValues<PageBorderless>(); 2168internal static string[] OutputQualityNames = Enum.GetNames(typeof(OutputQuality)); 2169internal static int[] OutputQualityEnums = (int[])(Array)Enum.GetValues<OutputQuality>(); 2180internal static string[] InputBinNames = Enum.GetNames(typeof(InputBin)); 2181internal static int[] InputBinEnums = (int[])(Array)Enum.GetValues<InputBin>();
PrintConfig\PrtCap_Public.cs (2)
56_countRootFeatures = Enum.GetNames(typeof(CapabilityName)).Length; 57_countLocalParamDefs = Enum.GetNames(typeof(PrintSchemaLocalParameterDefs)).Length;
Roslyn.VisualStudio.DiagnosticsWindow (2)
OptionPages\PerformanceLoggersPage.cs (1)
70var functionIds = Enum.GetValues(typeof(FunctionId)).Cast<FunctionId>().Where(isEnabled).ToImmutableArray();
Panels\TelemetryPanel.xaml.cs (1)
57var fixAllScopeValues = Enum.GetValues(typeof(FixAllScope));
Security.TransportSecurity.IntegrationTests (1)
Https\HttpsTests.4.1.0.cs (1)
41factory = new ChannelFactory<IWcfService>(basicHttpsBinding, new EndpointAddress(Endpoints.Https_DefaultBinding_Address + Enum.GetName(typeof(WSMessageEncoding), messageEncoding)));
ServerComparison.FunctionalTests (1)
HelloWorldTest.cs (1)
72string expectedName = Enum.GetName(typeof(RuntimeArchitecture), variant.Architecture);
Shared (2)
Throw\Throw.cs (2)
222where T : struct, Enum 225if (!Enum.IsDefined<T>(argument))
SocialWeather (1)
Pipe\PipeWeatherStreamFormatter.cs (1)
31if (tokens.Length < 2 || !Enum.TryParse<Weather>(tokens[1], out weather))
System.ComponentModel.Annotations (6)
System\ComponentModel\DataAnnotations\DataTypeAttribute.cs (1)
18private static readonly string[] _dataTypeStrings = Enum.GetNames<DataType>();
System\ComponentModel\DataAnnotations\EnumDataTypeAttribute.cs (4)
77? Enum.Parse(EnumType, stringValue, false) 78: Enum.ToObject(EnumType, value); 98return Enum.IsDefined(EnumType, convertedValue); 105Convert.ChangeType(enumValue, Enum.GetUnderlyingType(enumType), CultureInfo.InvariantCulture).ToString();
System\ComponentModel\DataAnnotations\Schema\DatabaseGeneratedAttribute.cs (1)
18if (!Enum.IsDefined(databaseGeneratedOption))
System.ComponentModel.Composition (1)
Microsoft\Internal\GenerationServices.cs (1)
90rawValue = Convert.ChangeType(value, Enum.GetUnderlyingType(valueType), null);
System.ComponentModel.TypeConverter (36)
System\ComponentModel\EnumConverter.cs (31)
15/// Provides a type converter to convert <see cref='System.Enum'/> objects to and 26if (!type.IsEnum && !type.Equals(typeof(Enum))) 44if (sourceType == typeof(string) || sourceType == typeof(Enum[])) 57if (destinationType == typeof(Enum[]) || destinationType == typeof(InstanceDescriptor)) 88bool isUnderlyingTypeUInt64 = Enum.GetUnderlyingType(EnumType) == typeof(ulong); 93convertedValue |= GetEnumValue(isUnderlyingTypeUInt64, Enum.Parse(EnumType, v, true), culture); 95return Enum.ToObject(EnumType, convertedValue); 99return Enum.Parse(EnumType, strValue, true); 107else if (value is Enum[]) 109bool isUnderlyingTypeUInt64 = Enum.GetUnderlyingType(EnumType) == typeof(ulong); 111foreach (Enum e in (Enum[])value) 115return Enum.ToObject(EnumType, finalValue); 131if (!EnumType.IsDefined(typeof(FlagsAttribute), false) && !Enum.IsDefined(EnumType, value)) 136return Enum.Format(EnumType, value, "G"); 150Type underlyingType = Enum.GetUnderlyingType(EnumType); 155MethodInfo? method = typeof(Enum).GetMethod("ToObject", new Type[] { typeof(Type), underlyingType }); 175if (destinationType == typeof(Enum[]) && value != null) 179bool isUnderlyingTypeUInt64 = Enum.GetUnderlyingType(EnumType) == typeof(ulong); 180List<Enum> flagValues = new List<Enum>(); 182Array objValues = Enum.GetValuesAsUnderlyingType(EnumType); 198flagValues.Add((Enum)Enum.ToObject(EnumType, ul)); 213flagValues.Add((Enum)Enum.ToObject(EnumType, longValue)); 220return new Enum[] { (Enum)Enum.ToObject(EnumType, value) }; 284value = Enum.Parse(EnumType, field.Name); 331public override bool IsValid(ITypeDescriptorContext? context, object? value) => Enum.IsDefined(EnumType, value!);
System\ComponentModel\ReflectPropertyDescriptor.cs (2)
204_defaultValue = Enum.ToObject(PropertyType, _defaultValue); 304Enum.ToObject(PropertyType, defaultValue!) :
System\ComponentModel\ReflectTypeDescriptionProvider.cs (2)
185[typeof(Enum)] = new IntrinsicTypeConverterData((type) => new EnumConverter(type), cacheConverterInstance: false), 1568converterData = IntrinsicTypeConverters[typeof(Enum)];
System\ComponentModel\ToolboxItemFilterAttribute.cs (1)
107public override string ToString() => FilterString + "," + Enum.GetName<ToolboxItemFilterType>(FilterType);
System.Configuration.ConfigurationManager (5)
System\Configuration\GenericEnumConverter.cs (2)
38return Enum.Parse(_enumType, value); 51string names = string.Join(", ", Enum.GetNames(_enumType));
System\Diagnostics\TraceConfiguration.cs (2)
58traceSource.Switch.Level = Enum.Parse<SourceLevels>(sourceElement.SwitchValue); 77traceSource.Switch.Level = Enum.Parse<SourceLevels>(sourceElement.SwitchValue);
System\Diagnostics\TraceUtils.cs (1)
199Enum.Parse(type, value, false) :
System.Data.Common (6)
System\Data\DataException.cs (1)
345private static Exception _InvalidEnumArgumentException<T>(T value) where T : Enum
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\DataTable.cs (1)
3131Debug.Assert(Enum.GetUnderlyingType(typeof(DataRowState)) == typeof(int), "Invalid DataRowState type");
System\Data\DataViewManager.cs (1)
135_dataViewSettingsCollection[table]!.RowStateFilter = Enum.Parse<DataViewRowState>(r.Value);
System.Diagnostics.Process (5)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.MountPoints.FormatInfo.cs (2)
15foreach (string name in Enum.GetNames<UnixFileSystemTypes>()) 62Enum.GetName(typeof(UnixFileSystemTypes), numericFormat) ?? string.Empty :
src\libraries\Common\src\Interop\Unix\System.Native\Interop.UnixFileSystemTypes.cs (1)
159Debug.Assert(Enum.IsDefined(fileSystemType) || fstatfsResult == 0, $"GetFileSystemType returned {fstatfsResult}");
System\Diagnostics\Process.cs (1)
483if (!Enum.IsDefined(value))
System\Diagnostics\ProcessStartInfo.cs (1)
177if (!Enum.IsDefined(value))
System.Diagnostics.TraceSource (2)
System\Diagnostics\SourceSwitch.cs (1)
36SwitchSetting = (int)Enum.Parse<SourceLevels>(Value, true);
System\Diagnostics\TraceSwitch.cs (1)
97TraceLevel level = Enum.Parse<TraceLevel>(Value, true);
System.Drawing.Common.Tests (4)
System\Drawing\BitmapTests.cs (1)
1132foreach (ImageLockMode lockMode in Enum.GetValues(typeof(ImageLockMode)))
System\Drawing\PenTests.cs (2)
1008if (Enum.IsDefined(typeof(DashCap), dashCap)) 1016Assert.Equal(Enum.IsDefined(typeof(DashCap), dashCap) ? dashCap : DashCap.Flat, pen.DashCap);
System\Drawing\Printing\PrintDocumentTests.cs (1)
246Assert.True(Enum.IsDefined(typeof(PrinterResolutionKind), pageSettings.PrinterResolution.Kind));
System.Formats.Asn1 (28)
System\Formats\Asn1\AsnDecoder.Enumerated.cs (10)
121where TEnum : Enum 125return (TEnum)Enum.ToObject( 189public static Enum ReadEnumeratedValue( 234return (Enum)Enum.ToObject(enumType, value); 255return (Enum)Enum.ToObject(enumType, value); 350public TEnum ReadEnumeratedValue<TEnum>(Asn1Tag? expectedTag = null) where TEnum : Enum 404public Enum ReadEnumeratedValue(Type enumType, Asn1Tag? expectedTag = null) 406Enum ret = AsnDecoder.ReadEnumeratedValue(_data.Span, RuleSet, enumType, out int consumed, expectedTag);
System\Formats\Asn1\AsnDecoder.NamedBitList.cs (11)
110where TFlagsEnum : Enum 114TFlagsEnum ret = (TFlagsEnum)Enum.ToObject( 177public static Enum ReadNamedBitListValue( 217Enum ret; 222ret = (Enum)Enum.ToObject(flagsEnumType, 0); 272ret = (Enum)Enum.ToObject(flagsEnumType, InterpretNamedBitListReversed(valueSpan)); 484public TFlagsEnum ReadNamedBitListValue<TFlagsEnum>(Asn1Tag? expectedTag = null) where TFlagsEnum : Enum 538public Enum ReadNamedBitListValue(Type flagsEnumType, Asn1Tag? expectedTag = null) 540Enum ret = AsnDecoder.ReadNamedBitListValue(
System\Formats\Asn1\AsnWriter.Enumerated.cs (4)
31/// <seealso cref="WriteEnumeratedValue(Enum,Asn1Tag?)"/> 33public void WriteEnumeratedValue(Enum value, Asn1Tag? tag = null) 66/// <seealso cref="WriteEnumeratedValue(Enum,Nullable{Asn1Tag})"/> 67public void WriteEnumeratedValue<TEnum>(TEnum value, Asn1Tag? tag = null) where TEnum : Enum
System\Formats\Asn1\AsnWriter.NamedBitList.cs (3)
35public void WriteNamedBitList(Enum value, Asn1Tag? tag = null) 70public void WriteNamedBitList<TEnum>(TEnum value, Asn1Tag? tag = null) where TEnum : Enum 109private void WriteNamedBitList(Asn1Tag? tag, Type tEnum, Enum value)
System.IO.Compression.ZipFile (1)
System\IO\Compression\ZipFile.Create.cs (1)
457if (compressionLevel.HasValue && !Enum.IsDefined(compressionLevel.Value))
System.IO.FileSystem.DriveInfo (3)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.MountPoints.FormatInfo.cs (2)
15foreach (string name in Enum.GetNames<UnixFileSystemTypes>()) 62Enum.GetName(typeof(UnixFileSystemTypes), numericFormat) ?? string.Empty :
src\libraries\Common\src\Interop\Unix\System.Native\Interop.UnixFileSystemTypes.cs (1)
159Debug.Assert(Enum.IsDefined(fileSystemType) || fstatfsResult == 0, $"GetFileSystemType returned {fstatfsResult}");
System.IO.FileSystem.Watcher (1)
System\IO\FileSystemWatcher.cs (1)
67foreach (int enumValue in Enum.GetValues<NotifyFilters>())
System.IO.Packaging (1)
System\IO\Packaging\InternalRelationshipCollection.cs (1)
324relationshipTargetMode = Enum.Parse<TargetMode>(targetModeAttributeValue, ignoreCase: false);
System.Linq.Expressions (17)
System\Dynamic\Utils\TypeUtils.cs (2)
259if (instanceType.IsEnum && AreReferenceAssignable(targetType, typeof(Enum))) 860source.IsValueType && (destination == typeof(object) || destination == typeof(ValueType)) || source.IsEnum && destination == typeof(Enum);
System\Linq\Expressions\Compiler\ILGen.cs (1)
571typeFrom == typeof(System.Enum) ||
System\Linq\Expressions\Interpreter\LightCompiler.cs (2)
1150nonNullableFrom = Enum.GetUnderlyingType(nonNullableFrom); 1155nonNullableTo = Enum.GetUnderlyingType(nonNullableTo);
System\Linq\Expressions\Interpreter\TypeOperations.cs (11)
399frame.Push(from == null ? null : Enum.ToObject(_t, from)); 426frame.Push(Enum.ToObject(_t, (int)from)); 429frame.Push(Enum.ToObject(_t, (long)from)); 432frame.Push(Enum.ToObject(_t, (uint)from)); 435frame.Push(Enum.ToObject(_t, (ulong)from)); 438frame.Push(Enum.ToObject(_t, (byte)from)); 441frame.Push(Enum.ToObject(_t, (sbyte)from)); 444frame.Push(Enum.ToObject(_t, (short)from)); 447frame.Push(Enum.ToObject(_t, (ushort)from)); 451frame.Push(Enum.ToObject(_t, (char)from)); 457frame.Push(Enum.ToObject(_t, (bool)from));
System\Linq\Expressions\Interpreter\Utilities.cs (1)
148result = Enum.ToObject(type, result);
System.Net.Http (1)
System\Net\Http\DiagnosticsHelper.cs (1)
84Debug.Assert(Enum.GetValues<HttpRequestError>().Length == 12, "We need to extend the mapping in case new values are added to HttpRequestError.");
System.Net.Security (3)
src\libraries\Common\src\System\Security\Cryptography\Asn1Reader\AsnValueReader.cs (2)
120internal TFlagsEnum ReadNamedBitListValue<TFlagsEnum>(Asn1Tag? expectedTag = default) where TFlagsEnum : Enum 213internal TEnum ReadEnumeratedValue<TEnum>(Asn1Tag? expectedTag = null) where TEnum : Enum
System\Net\Security\NetSecurityTelemetry.cs (1)
183Debug.Assert(Enum.GetValues<SslProtocols>()[^1] == SslProtocols.Tls13, "Make sure to add a counter for new SslProtocols");
System.Net.WebSockets (1)
System\Net\WebSockets\WebSocketStateHelper.cs (1)
46Debug.Assert(Enum.IsDefined(flag));
System.Private.CoreLib (103)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.UnixFileSystemTypes.cs (1)
159Debug.Assert(Enum.IsDefined(fileSystemType) || fstatfsResult == 0, $"GetFileSystemType returned {fstatfsResult}");
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Comparer.cs (1)
131internal sealed partial class EnumComparer<T> : Comparer<T>, ISerializable where T : struct, Enum
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\EqualityComparer.cs (1)
236public sealed partial class EnumEqualityComparer<T> : EqualityComparer<T>, ISerializable where T : struct, Enum
src\libraries\System.Private.CoreLib\src\System\ComponentModel\DefaultValueAttribute.cs (2)
63else if (type.IsSubclassOf(typeof(Enum)) && value != null) 65_value = Enum.Parse(type, value, true);
src\libraries\System.Private.CoreLib\src\System\Convert.cs (2)
212if (ReferenceEquals(targetType, typeof(Enum))) 213return (Enum)value;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\CodeAnalysis\StringSyntaxAttribute.cs (1)
47/// <summary>The syntax identifier for strings containing <see cref="Enum"/> format specifiers.</summary>
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\EventProvider.cs (2)
412if (data is Enum) 416Type underlyingType = Enum.GetUnderlyingType(data.GetType());
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (5)
1242public static implicit operator EventSourcePrimitive(Enum value) => new(value); 3055value = Enum.Parse(p.PropertyType, val); 5550if (type.IsEnum && Enum.GetUnderlyingType(type) != typeof(ulong) && Enum.GetUnderlyingType(type) != typeof(long)) 5672if (Enum.IsDefined(attribs.EventChannelType))
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\PropertyValue.cs (2)
177type = Enum.GetUnderlyingType(type); 228type = Enum.GetUnderlyingType(type);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\Statics.cs (1)
486dataType = Enum.GetUnderlyingType(dataType);
src\libraries\System.Private.CoreLib\src\System\Enum.cs (21)
57public static unsafe string? GetName<TEnum>(TEnum value) where TEnum : struct, Enum 84/// <paramref name="enumType"/> is not an <see cref="Enum"/>, or <paramref name="value"/> is neither of type <paramref name="enumType"/> 219public static string[] GetNames<TEnum>() where TEnum : struct, Enum 247/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 280/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 290public static TEnum[] GetValues<TEnum>() where TEnum : struct, Enum 302/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 320public static Array GetValuesAsUnderlyingType<TEnum>() where TEnum : struct, Enum => 399public bool HasFlag(Enum flag) 472public static unsafe bool IsDefined<TEnum>(TEnum value) where TEnum : struct, Enum 515/// <paramref name="enumType"/> is not an <see cref="Enum"/>, 544/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 556/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 572/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 597/// <exception cref="ArgumentException"><paramref name="enumType"/> is not an <see cref="Enum"/>.</exception> 613/// <exception cref="ArgumentException"><typeparamref name="TEnum"/> is not an <see cref="Enum"/> type</exception> 622/// <exception cref="ArgumentException"><typeparamref name="TEnum"/> is not an <see cref="Enum"/> type</exception> 636/// <exception cref="ArgumentException"><typeparamref name="TEnum"/> is not an <see cref="Enum"/> type</exception> 658/// <exception cref="ArgumentException"><typeparamref name="TEnum"/> is not an <see cref="Enum"/> type</exception> 1619/// <exception cref="ArgumentException">The <paramref name="enumType"/> parameter is not an <see cref="Enum"/> type.</exception> 1641return ((Enum)value).ToString(format);
src\libraries\System.Private.CoreLib\src\System\Environment.cs (2)
152if (!Enum.IsDefined(folder)) 155if (option != SpecialFolderOption.None && !Enum.IsDefined(option))
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (2)
4306if (Enum.TryFormatUnconstrained(value, _destination.Slice(_pos), out int charsWritten)) 4362if (Enum.TryFormatUnconstrained(value, _destination.Slice(_pos), out int charsWritten, format))
src\libraries\System.Private.CoreLib\src\System\Reflection\CustomAttributeTypedArgument.cs (1)
99private static object? CanonicalizeValue(object? value) => (value is Enum e) ? e.GetValue() : value;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\Opcode.cs (1)
117name = Enum.GetName(opCodeValue)!.ToLowerInvariant().Replace('_', '.');
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokeUtils.cs (9)
37dstObject = dstType.IsEnum ? Enum.ToObject(dstType, charValue) : charValue; 42dstObject = dstType.IsEnum ? Enum.ToObject(dstType, sbyteValue) : sbyteValue; 47dstObject = dstType.IsEnum ? Enum.ToObject(dstType, shortValue) : shortValue; 52dstObject = dstType.IsEnum ? Enum.ToObject(dstType, intValue) : intValue; 57dstObject = dstType.IsEnum ? Enum.ToObject(dstType, longValue) : longValue; 62dstObject = dstType.IsEnum ? Enum.ToObject(dstType, byteValue) : byteValue; 67dstObject = dstType.IsEnum ? Enum.ToObject(dstType, ushortValue) : ushortValue; 72dstObject = dstType.IsEnum ? Enum.ToObject(dstType, uintValue) : uintValue; 77dstObject = dstType.IsEnum ? Enum.ToObject(dstType, (long)ulongValue) : ulongValue;
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBase.cs (1)
160arg = Enum.ToObject(argumentType, arg);
src\libraries\System.Private.CoreLib\src\System\Resources\NeutralResourcesLanguageAttribute.cs (1)
24if (!Enum.IsDefined(location))
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (2)
254while (!Enum.TryFormatUnconstrained(value, _chars.Slice(_pos), out charsWritten)) 316while (!Enum.TryFormatUnconstrained(value, _chars.Slice(_pos), out charsWritten, format))
src\libraries\System.Private.CoreLib\src\System\RuntimeType.cs (22)
110return Enum.GetName(this, Enum.ToUInt64(value)); 121string[] ret = Enum.GetNamesNoCopy(this); 134Array values = Enum.GetValuesAsUnderlyingTypeNoCopy(this); 157return Enum.GetValuesAsUnderlyingType(this); 165return Enum.InternalGetUnderlyingType(this); 221return Array.IndexOf(Enum.GetNamesNoCopy(this), (string)value) >= 0; 227RuntimeType underlyingType = Enum.InternalGetUnderlyingType(this); 233TypeCode.SByte => Enum.IsDefinedPrimitive(this, (byte)(sbyte)value), 234TypeCode.Byte => Enum.IsDefinedPrimitive(this, (byte)value), 235TypeCode.Int16 => Enum.IsDefinedPrimitive(this, (ushort)(short)value), 236TypeCode.UInt16 => Enum.IsDefinedPrimitive(this, (ushort)value), 237TypeCode.Int32 => Enum.IsDefinedPrimitive(this, (uint)(int)value), 238TypeCode.UInt32 => Enum.IsDefinedPrimitive(this, (uint)value), 239TypeCode.Int64 => Enum.IsDefinedPrimitive(this, (ulong)(long)value), 240TypeCode.UInt64 => Enum.IsDefinedPrimitive(this, (ulong)value), 241TypeCode.Single => Enum.IsDefinedPrimitive(this, (float)value), 242TypeCode.Double => Enum.IsDefinedPrimitive(this, (double)value), 243TypeCode.Char => Enum.IsDefinedPrimitive(this, (char)value), 245underlyingType == typeof(nint) ? Enum.IsDefinedPrimitive(this, (nuint)(nint)value) : 246underlyingType == typeof(nuint) ? Enum.IsDefinedPrimitive(this, (nuint)value) : 763type = (RuntimeType)Enum.GetUnderlyingType(type);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (2)
2885if (Enum.TryFormatUnconstrained(value, _stringBuilder.RemainingCurrentChunk, out int charsWritten)) 2949if (Enum.TryFormatUnconstrained(value, _stringBuilder.RemainingCurrentChunk, out int charsWritten, format))
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (2)
725return Enum.TryFormatUnconstrained(value, utf16, out int charsWritten, format) ? 748if (Enum.TryFormatUnconstrained(value, array, out charsWritten, format))
src\libraries\System.Private.CoreLib\src\System\Type.cs (1)
126public virtual bool IsEnum { [Intrinsic] get => IsSubclassOf(typeof(Enum)); }
src\libraries\System.Private.CoreLib\src\System\Type.Enum.cs (2)
160ulArray[i] = Enum.ToUInt64(array.GetValue(i)!); 162ulong ulValue = Enum.ToUInt64(value);
src\libraries\System.Private.CoreLib\src\System\Type.Helpers.cs (1)
30if (underlyingType == typeof(Delegate) || underlyingType == typeof(Enum))
src\System\Collections\Generic\Comparer.CoreCLR.cs (1)
15internal sealed partial class EnumComparer<T> : Comparer<T> where T : struct, Enum
src\System\Collections\Generic\EqualityComparer.CoreCLR.cs (1)
162public sealed partial class EnumEqualityComparer<T> : EqualityComparer<T> where T : struct, Enum
src\System\Reflection\Emit\CustomAttributeBuilder.cs (2)
254return Type.GetTypeCode(Enum.GetUnderlyingType(t)) is 375switch (Type.GetTypeCode(Enum.GetUnderlyingType(type)))
src\System\Reflection\Emit\RuntimeEnumBuilder.cs (1)
308m_typeBuilder = new RuntimeTypeBuilder(name, visibility | TypeAttributes.Sealed, typeof(Enum), null, module, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize, null);
src\System\Reflection\Emit\RuntimeTypeBuilder.cs (1)
236underlyingType = Enum.GetUnderlyingType(destType);
src\System\Reflection\MdConstant.cs (1)
75return Enum.ToObject(fieldType, defaultValue);
src\System\Reflection\RuntimeCustomAttributeData.cs (2)
167if (type == typeof(Enum)) 503CustomAttributeEncoding.Enum => typeof(Enum),
src\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs (2)
364internal static bool EnumEquals<T>(T x, T y) where T : struct, Enum 372internal static int EnumCompareTo<T>(T x, T y) where T : struct, Enum
src\System\RuntimeType.CoreCLR.cs (3)
3452return IsSubclassOf(typeof(Enum)); 3454bool isEnum = th.AsMethodTable()->ParentMethodTable == Runtime.CompilerServices.TypeHandle.TypeHandleOf<Enum>().AsMethodTable(); 3468bool isEnum = !th.IsTypeDesc && th.AsMethodTable()->ParentMethodTable == Runtime.CompilerServices.TypeHandle.TypeHandleOf<Enum>().AsMethodTable();
System.Private.DataContractSerialization (13)
System\Runtime\Serialization\CodeGenerator.cs (3)
808Ldc(Convert.ChangeType(o, Enum.GetUnderlyingType(valueType), null)); 986Ldelem(Enum.GetUnderlyingType(arrayElementType)); 1025Stelem(Enum.GetUnderlyingType(arrayElementType));
System\Runtime\Serialization\DataContract.cs (2)
646"Enum" => typeof(Enum), 733else if (type == typeof(Enum) || type == typeof(ValueType))
System\Runtime\Serialization\EnumDataContract.cs (3)
129Type baseType = Enum.GetUnderlyingType(type); 372return Enum.ToObject(UnderlyingType, (object)(ulong)longValue); 373return Enum.ToObject(UnderlyingType, (object)longValue);
System\Runtime\Serialization\Json\JsonEnumDataContract.cs (2)
30enumValue = Enum.ToObject(TraditionalDataContract.UnderlyingType, jsonReader.ReadElementContentAsUnsignedLong()); 34enumValue = Enum.ToObject(TraditionalDataContract.UnderlyingType, jsonReader.ReadElementContentAsLong());
System\Runtime\Serialization\Json\JsonFormatGeneratorStatics.cs (1)
489s_parseEnumMethod = typeof(Enum).GetMethod("Parse", BindingFlags.Static | BindingFlags.Public, new Type[] { typeof(Type), typeof(string) });
System\Runtime\Serialization\Json\ReflectionJsonFormatReader.cs (1)
205pairKey = Enum.Parse(keyType, keyString);
System\Runtime\Serialization\Json\XmlObjectSerializerWriteContextComplexJson.cs (1)
124if (declaredContract.UnderlyingType == typeof(Enum))
System.Private.Windows.Core.TestUtilities (6)
XUnit\EnumDataAttribute.cs (2)
9public class EnumDataAttribute<TEnum> : CommonMemberDataAttribute where TEnum : struct, Enum 13public static ReadOnlyTheoryData TheoryData { get; } = new(Enum.GetValues<TEnum>());
XUnit\InvalidEnumDataAttribute.cs (4)
12public class InvalidEnumDataAttribute<TEnum> : CommonMemberDataAttribute where TEnum : unmanaged, Enum 33defined = Enum.IsDefined(currentValue); 53defined = Enum.IsDefined(currentValue); 63defined = Enum.IsDefined(currentValue);
System.Private.Xml (27)
System\Xml\Serialization\CodeGenerator.cs (3)
778Ldc(Convert.ChangeType(o, Enum.GetUnderlyingType(valueType), null)); 1034Ldelem(Enum.GetUnderlyingType(arrayElementType)); 1081Stelem(Enum.GetUnderlyingType(arrayElementType));
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (3)
1270return Enum.ToObject(mapping.TypeDesc!.Type!, ToEnum(source, table, mapping.TypeDesc.Name)); 1278return Enum.Parse(mapping.TypeDesc!.Type!, c.Name); 1705object choiceValue = Enum.Parse(choice.Mapping!.TypeDesc!.Type!, name);
System\Xml\Serialization\SoapReflectionImporter.cs (2)
752string strValue = Enum.Format(a.SoapDefaultValue.GetType(), a.SoapDefaultValue, "G").Replace(",", " "); 753string numValue = Enum.Format(a.SoapDefaultValue.GetType(), a.SoapDefaultValue, "D");
System\Xml\Serialization\XmlReflectionImporter.cs (2)
2156string strValue = Enum.Format(t, a.XmlDefaultValue, "G").Replace(",", " "); 2157string numValue = Enum.Format(t, a.XmlDefaultValue, "D");
System\Xml\Serialization\XmlSerializationReader.cs (1)
3006Writer.Write(typeof(Enum).FullName);
System\Xml\Serialization\XmlSerializationReaderILGen.cs (3)
993ilg.Ldc(Enum.ToObject(mapping.TypeDesc!.Type!, constants[i].Value)); 1030underlyingType = Enum.GetUnderlyingType(returnType); 1096retValues.Add(Enum.ToObject(mapping.TypeDesc.Type!, c.Value));
System\Xml\Serialization\XmlSerializationWriterILGen.cs (5)
222ilg.Ldc(Enum.Parse(mapping.TypeDesc.Type!, enumDefaultValue!, false)); 634ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type!, c.Value)); 2253eValue = Enum.ToObject(choiceMapping.TypeDesc!.Type!, choiceMapping.Constants[i].Value); 2267eValue = Enum.ToObject(choiceMapping.TypeDesc!.Type!, choiceMapping.Constants[i].Value); 2342ilg.Ldc(Enum.Parse(type, memberName, false));
System\Xml\Xsl\IlGen\OptimizerPatterns.cs (3)
57private static readonly int s_patternCount = Enum.GetValues<OptimizerPatternName>().Length; 245Debug.Assert(Enum.IsDefined(pattern)); 256Debug.Assert(Enum.IsDefined(pattern));
System\Xml\Xsl\IlGen\XmlILTrace.cs (1)
182string s = Enum.GetName(typeof(XmlILOptimization), opt)!;
System\Xml\Xsl\QIL\QilXmlWriter.cs (2)
209this.writer.WriteStartElement(Enum.GetName(n.NodeType)!); 280this.writer.WriteStartElement("", Enum.GetName(node.NodeType)!, "");
System\Xml\Xsl\Runtime\XmlExtensionFunction.cs (1)
330return Enum.GetUnderlyingType(clrType);
System\Xml\Xsl\XmlQueryTypeFactory.cs (1)
350XmlTypeCode[] arrEnum = Enum.GetValues<XmlTypeCode>();
System.Reflection.Emit (1)
System\Reflection\Emit\EnumBuilderImpl.cs (1)
19_typeBuilder = new TypeBuilderImpl(name, visibility | TypeAttributes.Sealed, typeof(Enum), module,
System.Reflection.Metadata (3)
System\Reflection\Metadata\BlobWriterImpl.cs (2)
159type = Enum.GetUnderlyingType(type); 232type = Enum.GetUnderlyingType(type);
System\Reflection\Metadata\Ecma335\Encoding\BlobEncoders.cs (1)
594/// <see cref="Enum"/> (encoded as the underlying integer value).
System.Resources.Extensions (1)
src\libraries\Common\src\System\Resources\ResourceWriter.cs (1)
492ResourceTypeCode typeCode = Enum.Parse<ResourceTypeCode>(typeName);
System.Resources.Writer (1)
src\libraries\Common\src\System\Resources\ResourceWriter.cs (1)
492ResourceTypeCode typeCode = Enum.Parse<ResourceTypeCode>(typeName);
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
177[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Enum))]
System.Security.Cryptography (2)
src\libraries\Common\src\System\Security\Cryptography\Asn1Reader\AsnValueReader.cs (2)
120internal TFlagsEnum ReadNamedBitListValue<TFlagsEnum>(Asn1Tag? expectedTag = default) where TFlagsEnum : Enum 213internal TEnum ReadEnumeratedValue<TEnum>(Asn1Tag? expectedTag = null) where TEnum : Enum
System.Security.Cryptography.Pkcs (2)
src\libraries\Common\src\System\Security\Cryptography\Asn1Reader\AsnValueReader.cs (2)
120internal TFlagsEnum ReadNamedBitListValue<TFlagsEnum>(Asn1Tag? expectedTag = default) where TFlagsEnum : Enum 213internal TEnum ReadEnumeratedValue<TEnum>(Asn1Tag? expectedTag = null) where TEnum : Enum
System.ServiceModel.Federation (1)
System\ServiceModel\Federation\WSTrustChannelSecurityTokenProvider.cs (1)
369if (!Enum.IsDefined(typeof(SecurityKeyEntropyMode), value))
System.ServiceModel.NetFramingBase (1)
System\ServiceModel\Channels\SslProtocolsHelper.cs (1)
14foreach (var protocol in Enum.GetValues(typeof(SslProtocols)))
System.ServiceModel.UnixDomainSocket (1)
System\ServiceModel\Channels\SslProtocolsHelper.cs (1)
14foreach (var protocol in Enum.GetValues(typeof(SslProtocols)))
System.Text.Encodings.Web (1)
System\Text\Encodings\Web\ThrowHelper.cs (1)
25Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument),
System.Text.Json (11)
src\libraries\System.Text.Json\Common\ReflectionExtensions.cs (2)
308return Enum.ToObject(parameterType, defaultValue); 313return Enum.ToObject(underlyingType, defaultValue);
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (5)
17where T : struct, Enum 269success = Enum.TryParse(source, out result); 408s_isFlagsEnum || (dictionaryKeyPolicy is not null && Enum.IsDefined(typeof(T), value)), 525string[] names = Enum.GetNames<T>(); 526T[] values = Enum.GetValues<T>();
System\Text\Json\Serialization\Converters\Value\EnumConverterFactory.cs (1)
57where T : struct, Enum
System\Text\Json\Serialization\JsonNumberEnumConverter.cs (1)
18where TEnum : struct, Enum
System\Text\Json\Serialization\JsonStringEnumConverter.cs (1)
17where TEnum : struct, Enum
System\Text\Json\Serialization\Metadata\JsonMetadataServices.Converters.cs (1)
283public static JsonConverter<T> GetEnumConverter<T>(JsonSerializerOptions options) where T : struct, Enum
System.Text.Json.SourceGeneration (1)
Helpers\SourceGeneratorHelpers.cs (1)
13public static string FormatEnumLiteral<TEnum>(string fullyQualifiedName, TEnum value) where TEnum : struct, Enum
System.Text.RegularExpressions (6)
System\Text\RegularExpressions\RegexWriter.cs (2)
31Debug.Assert(!Enum.IsDefined(BeforeChild)); 32Debug.Assert(!Enum.IsDefined(AfterChild));
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (2)
378Debug.Assert(!Enum.IsDefined((UnicodeCategory)UnicodeCategoryCount)); 523Debug.Assert(Enum.IsDefined(code) || code == (UnicodeCategory)(RegexCharClass.SpaceConst - 1), $"Unknown category: {code}");
System\Text\RegularExpressions\Symbolic\UnicodeCategoryConditions.cs (1)
30Debug.Assert(Enum.GetValues<UnicodeCategory>().Length == UnicodeCategoryValueCount);
System\Text\RegularExpressions\Symbolic\UnicodeCategoryRangesGenerator.cs (1)
42foreach (UnicodeCategory c in Enum.GetValues<UnicodeCategory>())
System.Windows.Forms (25)
System\Windows\Forms\ActiveX\AxHost.AxPropertyDescriptor.cs (1)
226_baseDescriptor.SetValue(component, Enum.ToObject(PropertyType, value));
System\Windows\Forms\ComponentModel\COM2Interop\COM2EnumConverter.cs (1)
35? Enum.ToObject(destinationType, value)
System\Windows\Forms\ComponentModel\COM2Interop\Com2IPerPropertyBrowsingHandler.Com2IPerPropertyBrowsingEnum.cs (1)
114valueItems[i] = Enum.ToObject(targetType, valueItems[i]);
System\Windows\Forms\ComponentModel\COM2Interop\COM2PropertyDescriptor.cs (1)
660_lastValue = Enum.ToObject(_propertyType, _lastValue);
System\Windows\Forms\Controls\DataGridView\DataGridViewBand.cs (1)
501if (!Enum.IsDefined(value))
System\Windows\Forms\Controls\DataGridView\DataGridViewCellStyle.cs (1)
97Debug.Assert(Enum.IsDefined(value));
System\Windows\Forms\Controls\DataGridView\DataGridViewHeaderCell.cs (1)
564Debug.Assert(Enum.IsDefined(newButtonState));
System\Windows\Forms\Controls\ListView\ListView.ListViewAccessibleObject.cs (1)
14private static readonly int[] s_enumViewValues = (int[])Enum.GetValues(typeof(View));
System\Windows\Forms\Controls\ListView\ListViewItem.IKeyboardToolTip.cs (1)
34foreach (SearchDirectionHint searchDirectionHint in Enum.GetValues(typeof(SearchDirectionHint)))
System\Windows\Forms\Controls\WebBrowser\WebBrowser.WebBrowserSite.cs (1)
165if (lpMsg->message != PInvokeCore.WM_CHAR && Enum.IsDefined((Shortcut)keyCode))
System\Windows\Forms\Input\KeyEventArgs.cs (1)
48if (!Enum.IsDefined(keyGenerated))
System\Windows\Forms\Input\KeysConverter.cs (12)
131=> sourceType == typeof(string) || sourceType == typeof(Enum[]) || base.CanConvertFrom(context, sourceType); 138=> destinationType == typeof(Enum[]) || base.CanConvertTo(context, destinationType); 175currentKey = (Keys)Enum.Parse(typeof(Keys), token); 199if (value is Enum[] valueAsEnumArray) 202foreach (Enum e in valueAsEnumArray) 207return Enum.ToObject(typeof(Keys), finalValue); 231: destinationType == typeof(Enum[]) 235Enum[] GetTermKeys(Keys key) 237List<Enum> termKeys = []; 275if (!foundKey && Enum.IsDefined(keyOnly)) 323if (!foundKey && Enum.IsDefined(keyOnly)) 325termStrings.Append(Enum.GetName(keyOnly));
System\Windows\Forms\Input\PreviewKeyDownEventArgs.cs (1)
38if (!Enum.IsDefined(keyGenerated))
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutSettingsTypeConverter.cs (1)
197SizeType type = (SizeType)Enum.Parse(sizeTypeType, styleString.AsSpan(currentIndex, nextIndex - currentIndex), true);
System.Windows.Forms.Analyzers.CSharp (3)
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ProjectFileReader.cs (2)
111if (!Enum.TryParse(rawValue, true, out highDpiMode) || 112!Enum.IsDefined(typeof(HighDpiMode), highDpiMode))
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ProjectFileReader.FontConverter.cs (1)
104fontStyle |= (FontStyle)Enum.Parse(typeof(FontStyle), styleText, true);
System.Windows.Forms.Analyzers.CSharp.Tests (1)
Generators\ApplicationConfigurationGeneratorTests.cs (1)
48foreach (OutputKind projectType in Enum.GetValues(typeof(OutputKind)))
System.Windows.Forms.Analyzers.Tests (4)
System\Windows\Forms\Analyzers\ApplicationConfigTests.FontStyle.cs (2)
16var values = Enum.GetValues(typeof(FontStyle)); 28FontStyle value = Enum.Parse<FontStyle>(input);
System\Windows\Forms\Analyzers\ApplicationConfigTests.GraphicsUnit.cs (2)
17var values = Enum.GetValues(typeof(GraphicsUnit)); 31GraphicsUnit value = Enum.Parse<GraphicsUnit>(input);
System.Windows.Forms.Design (9)
System\ComponentModel\Design\Serialization\CodeDomSerializationProvider.cs (1)
68if (typeof(Enum).IsAssignableFrom(objectType))
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (2)
1406if (result != left && left is Enum) 1409result = Enum.ToObject(left.GetType(), result);
System\ComponentModel\Design\Serialization\EnumCodeDomSerializer.cs (6)
27if (value is not Enum enumValue) 34Enum[] values; 36if (converter is not null && converter.CanConvertTo(typeof(Enum[]))) 38values = (Enum[])converter.ConvertTo(enumValue, typeof(Enum[]))!; 61foreach (Enum term in values)
System.Windows.Forms.Design.Tests (2)
System\ComponentModel\Design\ByteViewerTests.cs (1)
453foreach (DisplayMode displayMode in Enum.GetValues(typeof(DisplayMode)))
System\Windows\Forms\Design\Behavior\SnapLineTests.cs (1)
91foreach (object type in Enum.GetValues(typeof(SnapLineType)))
System.Windows.Forms.Primitives (2)
System\EnumExtensions.cs (1)
19public static unsafe void ChangeFlags<T>(ref this T value, T flags, bool set) where T : unmanaged, Enum
System\Windows\Forms\Internals\ScaleHelper.cs (1)
86Debug.Assert(Enum.IsDefined(processDpiAwareness));
System.Windows.Forms.Primitives.Tests (1)
System\Windows\Forms\Automation\UiaTextRangeTests.cs (1)
401Array textAttributeIdentifiers = Enum.GetValues(typeof(UIA_TEXTATTRIBUTE_ID));
System.Windows.Forms.Primitives.TestUtilities (1)
Metafiles\RecordTypes\EMRENUMRECORD.cs (1)
26internal struct EMRENUMRECORD<T> where T : Enum
System.Windows.Forms.Tests (396)
MaskedTextBoxTests.cs (1)
438if (!Enum.IsDefined(typeof(InsertKeyMode), insertMode))
System\Windows\Forms\AccessibleObjects\Button.ButtonAccessibleObjectTests.cs (1)
101Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ButtonBase.ButtonBaseAccessibleObjectTests.cs (1)
209Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\CheckBox.CheckBoxAccessibleObjectTests.cs (1)
281Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\CheckedListBoxAccessibleObjectTests.cs (1)
60Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ComboBox.ComboBoxAccessibleObjectTests.cs (3)
126foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 167foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 241Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ComboBox.ComboBoxItemAccessibleObjectTests.cs (4)
234foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 277foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 365foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 420foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle)))
System\Windows\Forms\AccessibleObjects\Control.ControlAccessibleObjectTests.cs (1)
1383Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\DataGridView.DataGridViewEditingPanelAccessibleObjectTests.cs (1)
81Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\DataGridViewAccessibleObjectTests.cs (1)
483Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\DataGridViewComboBoxCellAccessibleObjectTests.cs (2)
12foreach (DataGridViewComboBoxDisplayStyle displayStyle in Enum.GetValues(typeof(DataGridViewComboBoxDisplayStyle))) 43foreach (DataGridViewComboBoxDisplayStyle displayStyle in Enum.GetValues(typeof(DataGridViewComboBoxDisplayStyle)))
System\Windows\Forms\AccessibleObjects\DataGridViewComboBoxEditingControlAccessibleObjectTests.cs (1)
56Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\DataGridViewTextBoxEditingControl.DataGridViewTextBoxEditingControlAccessibleObjectTests.cs (1)
92Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\DateTimePicker.DateTimePickerAccessibleObjectTests.cs (1)
62Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\DomainUpDownAccessibleObjectTests.cs (1)
68Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\Form.FormAccessibleObjectTests.cs (1)
75Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\GroupBoxAccessibleObjectTests.cs (1)
95Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\HScrollBar.HScrollBarAccessibleObjectTests.cs (1)
83Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\LabelAccessibleObjectTests.cs (1)
98Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\LinkLabel.LinkLabelAccessibleObjectTests.cs (1)
36Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ListBoxAccessibleObjectTests.cs (1)
60Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ListVIew.ListViewAccessibleObjectTests.cs (7)
230foreach (View view in Enum.GetValues(typeof(View))) 314foreach (View view in Enum.GetValues(typeof(View))) 479foreach (View view in Enum.GetValues(typeof(View))) 900foreach (View view in Enum.GetValues(typeof(View))) 986foreach (View view in Enum.GetValues(typeof(View))) 1111Array roles = Enum.GetValues(typeof(AccessibleRole)); 1234foreach (View view in Enum.GetValues(typeof(View)))
System\Windows\Forms\AccessibleObjects\ListViewGroup.ListViewGroupAccessibleObjectTests.cs (6)
351foreach (View view in Enum.GetValues(typeof(View))) 535foreach (View view in Enum.GetValues(typeof(View))) 557foreach (View view in Enum.GetValues(typeof(View))) 634foreach (View view in Enum.GetValues(typeof(View))) 1298foreach (View view in Enum.GetValues(typeof(View))) 1304foreach (ListViewGroupCollapsedState listViewGroupCollapsedState in Enum.GetValues(typeof(ListViewGroupCollapsedState)))
System\Windows\Forms\AccessibleObjects\ListViewItem.ListViewItemAccessibleObjectTests.cs (13)
48foreach (View view in Enum.GetValues(typeof(View))) 118foreach (View view in Enum.GetValues(typeof(View))) 172foreach (View view in Enum.GetValues(typeof(View))) 536foreach (View view in Enum.GetValues(typeof(View))) 628foreach (View view in Enum.GetValues(typeof(View))) 669foreach (View view in Enum.GetValues(typeof(View))) 732foreach (View view in Enum.GetValues(typeof(View))) 806foreach (View view in Enum.GetValues(typeof(View))) 857foreach (View view in Enum.GetValues(typeof(View))) 1683foreach (View oldView in Enum.GetValues(typeof(View))) 1685foreach (View newView in Enum.GetValues(typeof(View))) 1798foreach (View view in Enum.GetValues(typeof(View))) 1816foreach (ListViewGroupCollapsedState state in Enum.GetValues(typeof(ListViewGroupCollapsedState)))
System\Windows\Forms\AccessibleObjects\MaskedTextBox.MaskedTextBoxAccessibleObjectTests.cs (1)
49Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\MenuStrip.MenuStripAccessibleObjectTests.cs (7)
112Array roles = Enum.GetValues(typeof(AccessibleRole)); 141Array directions = Enum.GetValues<NavigateDirection>(); 497foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 514foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 734foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 775foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 875foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>())
System\Windows\Forms\AccessibleObjects\MonthCalendar.MonthCalendarAccessibleObjectTests.cs (1)
50Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\NumericUpDownAccessibleObjectTests.cs (1)
66Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\Panel.PanelAccessibleObjectTests.cs (1)
90Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\PictureBox.PictureBoxAccessibleObjectTests.cs (1)
123Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ProgressBarAccessibleObjectTests.cs (1)
124Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\PropertyGrid.PropertyGridAccessibleObjectTests.cs (1)
82Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\RadioButton.RadioButtonAccessibleObjectTests.cs (1)
227Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ScrollBar.ScrollBarAccessibleObjectTests.cs (1)
77Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\SplitContainer.SplitContainerAccessibleObjectTests.cs (1)
48Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\Splitter.SplitterAccessibleObjectTests.cs (1)
128Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\StatusStrip.StatusStripAccessibleObjectTests.cs (7)
92Array roles = Enum.GetValues(typeof(AccessibleRole)); 121Array directions = Enum.GetValues<NavigateDirection>(); 477foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 494foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 714foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 755foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 856foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>())
System\Windows\Forms\AccessibleObjects\TabControl.TabControlAccessibleObjectTests.cs (1)
51Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\TabPage.TabPageAccessibleObjectTests.cs (1)
54Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\TextBoxAccessibleObjectTests.cs (1)
66Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\TextBoxBaseAccessibleObjectTests.cs (1)
139Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripAccessibleObjectTests.cs (7)
90Array roles = Enum.GetValues(typeof(AccessibleRole)); 119Array directions = Enum.GetValues<NavigateDirection>(); 490foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 507foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 727foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 768foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>()) 868foreach (ToolStripGripStyle grip in Enum.GetValues<ToolStripGripStyle>())
System\Windows\Forms\AccessibleObjects\ToolStripButton.ToolStripButtonAccessibleObjectTests.cs (1)
70Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripComboBox.ToolStripComboBoxControl.ToolStripComboBoxControlAccessibleObjectTests.cs (1)
42Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripDropDown.ToolStripDropDownAccessibleObjectTests.cs (1)
49Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripDropDownButton.ToolStripDropDownButtonAccessibleObjectTests.cs (1)
45Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripGrip.ToolStripGripAccessibleObjectTests.cs (1)
44Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripItemAccessibleObjectTests.cs (1)
143Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripLabel.ToolStripLabelAccessibleObjectTests.cs (1)
51Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripMenuItem.ToolStripMenuItemAccessibleObjectTests.cs (1)
91Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripNumericUpDown.ToolStripNumericUpDownAccessibleObjectTests.cs (1)
55Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripOverflow.ToolStripOverflowAccessibleObjectTests.cs (1)
51Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripOverflowButton.ToolStripOverflowButtonAccessibleObjectTests.cs (1)
50Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripProgressBar.ToolStripProgressBarControl.ToolStripProgressBarControlAccessibleObjectTests.cs (1)
54Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripSeparator.ToolStripSeparatorAccessibleObjectTests.cs (1)
44Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripSplitButton.ToolStripSplitButtonAccessibleObjectTests.cs (1)
44Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripStatusLabel.ToolStripStatusLabelAccessibleObjectTests.cs (1)
50Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\ToolStripTextBox.ToolStripTextBoxControlAccessibleObjectTests.cs (1)
111Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\TrackBar.TrackBarAccessibleObjectTests.cs (1)
282Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\TrackBar.TrackBarFirstButtonAccessibleObjectTests.cs (1)
102foreach (Orientation orientation in Enum.GetValues(typeof(Orientation)))
System\Windows\Forms\AccessibleObjects\TrackBar.TrackBarLastButtonAccessibleObjectTests.cs (1)
102foreach (Orientation orientation in Enum.GetValues(typeof(Orientation)))
System\Windows\Forms\AccessibleObjects\UpDownBase.UpDownButtons.UpDownButtonsAccessibleObjectTests.cs (1)
54Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\UpDownBase.UpDownEdit.UpDownEditAccessibleObjectTests.cs (1)
168Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleObjects\VScrollBar.VScrollBarAccessibleObjectTests.cs (1)
82Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\AccessibleRoleControlTypeMapTests.cs (1)
12Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\ApplicationTests.cs (2)
114Assert.True(Enum.IsDefined(state)); 127VisualStyleState value = Enum.Parse<VisualStyleState>(valueString);
System\Windows\Forms\BindingTests.cs (2)
548foreach (ControlUpdateMode controlUpdateMode in Enum.GetValues(typeof(ControlUpdateMode))) 594foreach (ControlUpdateMode controlUpdateMode in Enum.GetValues(typeof(ControlUpdateMode)))
System\Windows\Forms\ButtonBaseTests.cs (33)
182foreach (ContentAlignment textAlign in Enum.GetValues(typeof(ContentAlignment))) 1044foreach (FlatStyle value in Enum.GetValues(typeof(FlatStyle))) 1082foreach (FlatStyle oldValue in Enum.GetValues(typeof(FlatStyle))) 1084foreach (FlatStyle value in Enum.GetValues(typeof(FlatStyle))) 1841foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 1873foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 1931foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 1977foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 2709foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 3264foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 3266foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 3300foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 3302foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 3362foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 3412foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 3500foreach (TextImageRelation value in Enum.GetValues(typeof(TextImageRelation))) 4995foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5478foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5524foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5570foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5628foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5743foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5792foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 5897foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6092foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6141foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6210foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6410foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6505foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6619foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6683foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6750foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 6825foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle)))
System\Windows\Forms\ButtonTests.cs (5)
204foreach (ContentAlignment textAlign in Enum.GetValues(typeof(ContentAlignment))) 1805foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 2641foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 2693foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 2796foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle)))
System\Windows\Forms\ComboBox.ComboBoxChildDropDownButtonUiaProviderTests.cs (1)
12foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle)))
System\Windows\Forms\ComboBox.ComboBoxChildEditUiaProviderTests.cs (2)
13foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 61foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle)))
System\Windows\Forms\ComboBox.ComboBoxChildListUiaProviderTests.cs (2)
13foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 85foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle)))
System\Windows\Forms\ComboBox.ComboBoxChildNativeWindowTests.cs (1)
17foreach (object childWindowType in Enum.GetValues(childWindowTypeEnum))
System\Windows\Forms\ComboBox.ComboBoxUiaTextProviderTests.cs (7)
322foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 478foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 516foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 555foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 605foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 758foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle))) 800foreach (ComboBoxStyle comboBoxStyle in Enum.GetValues(typeof(ComboBoxStyle)))
System\Windows\Forms\ComboBoxTests.cs (2)
839foreach (AutoCompleteSource source in Enum.GetValues(typeof(AutoCompleteSource))) 841foreach (AutoCompleteMode mode in Enum.GetValues(typeof(AutoCompleteMode)))
System\Windows\Forms\CommonDialogTests.cs (3)
128DialogResult expectedDialogResult = (DialogResult)Enum.Parse(typeof(DialogResult), expectedDialogResultString); 166DialogResult expectedDialogResult = (DialogResult)Enum.Parse(typeof(DialogResult), expectedDialogResultString); 202DialogResult expectedDialogResult = (DialogResult)Enum.Parse(typeof(DialogResult), expectedDialogResultString);
System\Windows\Forms\ControlPaintTests.cs (14)
710foreach (Border3DStyle style in Enum.GetValues(typeof(Border3DStyle))) 735foreach (Border3DStyle style in Enum.GetValues(typeof(Border3DStyle))) 737foreach (Border3DSide side in Enum.GetValues(typeof(Border3DSide))) 812foreach (ButtonState state in Enum.GetValues(typeof(ButtonState))) 893foreach (CaptionButton button in Enum.GetValues(typeof(CaptionButton))) 895foreach (ButtonState state in Enum.GetValues(typeof(ButtonState))) 976foreach (ButtonState state in Enum.GetValues(typeof(ButtonState))) 1057foreach (ButtonState state in Enum.GetValues(typeof(ButtonState))) 1387foreach (MenuGlyph glyph in Enum.GetValues(typeof(MenuGlyph))) 1410foreach (MenuGlyph glyph in Enum.GetValues(typeof(MenuGlyph))) 1518foreach (ButtonState state in Enum.GetValues(typeof(ButtonState))) 1598foreach (ButtonState state in Enum.GetValues(typeof(ButtonState))) 1733foreach (ScrollButton button in Enum.GetValues(typeof(ScrollButton))) 1735foreach (ButtonState state in Enum.GetValues(typeof(ButtonState)))
System\Windows\Forms\ControlTests.Handlers.cs (4)
3838foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 3901foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 3945foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 4073foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout)))
System\Windows\Forms\ControlTests.Methods.ClipboardTests.cs (1)
20foreach (DragDropEffects allowedEffects in Enum.GetValues(typeof(DragDropEffects)))
System\Windows\Forms\ControlTests.Methods.cs (12)
2394foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 2567foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 2656foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 2706foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 2756foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 6874foreach (ContentAlignment align in Enum.GetValues(typeof(ContentAlignment))) 6909foreach (LeftRightAlignment align in Enum.GetValues(typeof(LeftRightAlignment))) 6937foreach (HorizontalAlignment align in Enum.GetValues(typeof(HorizontalAlignment))) 8898foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 9027foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 9169foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 9442foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified)))
System\Windows\Forms\ControlTests.Properties.cs (3)
736foreach (DockStyle dock in Enum.GetValues(typeof(DockStyle))) 4317foreach (AnchorStyles anchor in Enum.GetValues(typeof(AnchorStyles))) 4319foreach (DockStyle value in Enum.GetValues(typeof(DockStyle)))
System\Windows\Forms\DataGridViewColumnCollectionTests.cs (2)
143foreach (DataGridViewAutoSizeColumnsMode columnsAutoSizeMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnsMode))) 145foreach (DataGridViewAutoSizeColumnMode autoSizeMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode)))
System\Windows\Forms\DataGridViewColumnTests.cs (8)
142foreach (DataGridViewAutoSizeColumnsMode dataGridMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnsMode))) 207foreach (DataGridViewAutoSizeColumnsMode dataGridMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnsMode))) 367foreach (DataGridViewAutoSizeColumnMode oldValue in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode))) 369foreach (DataGridViewAutoSizeColumnMode value in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode))) 1152foreach (DataGridViewAutoSizeColumnMode autoSizeMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode))) 1188foreach (DataGridViewAutoSizeColumnMode autoSizeMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode))) 1551foreach (DataGridViewAutoSizeColumnMode autoSizeMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode))) 1591foreach (DataGridViewAutoSizeColumnMode autoSizeMode in Enum.GetValues(typeof(DataGridViewAutoSizeColumnMode)))
System\Windows\Forms\DataGridViewHeaderCellTests.cs (11)
906foreach (DataGridViewColumnHeadersHeightSizeMode columnHeadersHeightSizeMode in Enum.GetValues(typeof(DataGridViewColumnHeadersHeightSizeMode))) 908foreach (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode))) 910foreach (DataGridViewTriState columnResizable in Enum.GetValues(typeof(DataGridViewTriState))) 972foreach (DataGridViewColumnHeadersHeightSizeMode columnHeadersHeightSizeMode in Enum.GetValues(typeof(DataGridViewColumnHeadersHeightSizeMode))) 974foreach (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode))) 976foreach (DataGridViewTriState rowResizable in Enum.GetValues(typeof(DataGridViewTriState))) 1014foreach (DataGridViewColumnHeadersHeightSizeMode columnHeadersHeightSizeMode in Enum.GetValues(typeof(DataGridViewColumnHeadersHeightSizeMode))) 1016foreach (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode))) 2679foreach (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode))) 2681foreach (DataGridViewColumnHeadersHeightSizeMode columnHeadersHeightSizeMode in Enum.GetValues(typeof(DataGridViewColumnHeadersHeightSizeMode))) 4021ButtonState expectedButtonState = (ButtonState)Enum.Parse(typeof(ButtonState), expectedButtonStateString);
System\Windows\Forms\DataGridViewRowTests.cs (2)
1924foreach (DataGridViewAutoSizeRowsMode autoSizeRowsMode in Enum.GetValues(typeof(DataGridViewAutoSizeRowsMode))) 2393foreach (DataGridViewAutoSizeRowsMode autoSizeRowsMode in Enum.GetValues(typeof(DataGridViewAutoSizeRowsMode)))
System\Windows\Forms\DataGridViewTests.cs (4)
498foreach (DataGridViewColumnHeadersHeightSizeMode value in Enum.GetValues(typeof(DataGridViewColumnHeadersHeightSizeMode))) 1426foreach (DataGridViewRowHeadersWidthSizeMode value in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode))) 1908foreach (DataGridViewColumnHeadersHeightSizeMode columnHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewColumnHeadersHeightSizeMode))) 2389foreach (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode in Enum.GetValues(typeof(DataGridViewRowHeadersWidthSizeMode)))
System\Windows\Forms\ErrorProviderTests.cs (2)
1029foreach (ErrorBlinkStyle blinkStyle in Enum.GetValues(typeof(ErrorBlinkStyle))) 1124foreach (ErrorBlinkStyle blinkStyle in Enum.GetValues(typeof(ErrorBlinkStyle)))
System\Windows\Forms\FormTests.cs (3)
1851foreach (DialogResult dialogResult in Enum.GetValues(typeof(DialogResult))) 1888foreach (DialogResult dialogResult in Enum.GetValues(typeof(DialogResult))) 2118foreach (DialogResult dialogResult in Enum.GetValues(typeof(DialogResult)))
System\Windows\Forms\GroupBoxTests.cs (1)
1827foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft)))
System\Windows\Forms\KeyEventArgsTests.cs (1)
34if (Enum.IsDefined(typeof(Keys), e.KeyValue))
System\Windows\Forms\KeysConverterTests.cs (11)
87yield return new object[] { "fr-FR", Keys.None, new Enum[] { Keys.None } }; 88yield return new object[] { "de-DE", Keys.S, new Enum[] { Keys.S } }; 89yield return new object[] { "zh-CN", Keys.Control | Keys.C, new Enum[] { Keys.Control, Keys.C } }; 90yield return new object[] { "it-IT", Keys.Control | Keys.Add, new Enum[] { Keys.Control, Keys.Add } }; 91yield return new object[] { "ko-KR", Keys.Control | Keys.Alt | Keys.D, new Enum[] { Keys.Control, Keys.Alt, Keys.D } }; 92yield return new object[] { "ru-RU", Keys.Control | Keys.Alt | Keys.Shift | Keys.A, new Enum[] { Keys.Control, Keys.Alt, Keys.Shift, Keys.A } }; 93yield return new object[] { "zh-TW", Keys.Control | Keys.Alt | Keys.Shift | Keys.F1, new Enum[] { Keys.Control, Keys.Alt, Keys.Shift, Keys.F1 } }; 98public void ConvertToEnumArray_ShouldConvertKeys(string cultureName, Keys keys, Enum[] expectedResult) 101object result = converter.ConvertTo(keys, typeof(Enum[])); 109object resultWithoutCulture = converter.ConvertTo(context: null, culture: null, keys, typeof(Enum[])); 110object resultWithUICulture = converter.ConvertTo(context: null, culture: Thread.CurrentThread.CurrentUICulture, keys, typeof(Enum[]));
System\Windows\Forms\LabelTests.cs (2)
253foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 307foreach (BorderStyle style in Enum.GetValues(typeof(BorderStyle)))
System\Windows\Forms\ListBoxTests.cs (6)
1705foreach (Enum drawMode in Enum.GetValues(typeof(DrawMode))) 3382foreach (SelectionMode selectionMode in Enum.GetValues(typeof(SelectionMode))) 3384foreach (SelectionMode value in Enum.GetValues(typeof(SelectionMode))) 4788foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 5155foreach (DrawMode drawMode in Enum.GetValues(typeof(DrawMode)))
System\Windows\Forms\ListViewGroupTests.cs (3)
640foreach (HorizontalAlignment value in Enum.GetValues(typeof(HorizontalAlignment))) 746HorizontalAlignment value = (HorizontalAlignment)Enum.Parse(typeof(HorizontalAlignment), valueString); 998HorizontalAlignment value = (HorizontalAlignment)Enum.Parse(typeof(HorizontalAlignment), valueString);
System\Windows\Forms\ListViewTests.cs (11)
797foreach (ListViewAlignment alignment in Enum.GetValues(typeof(ListViewAlignment))) 903foreach (ListViewAlignment alignment in Enum.GetValues(typeof(ListViewAlignment))) 4299foreach (View view in Enum.GetValues(typeof(View))) 4348foreach (View view in Enum.GetValues(typeof(View))) 4443foreach (View view in Enum.GetValues(typeof(View))) 4688foreach (View view in Enum.GetValues(typeof(View))) 4754foreach (View view in Enum.GetValues(typeof(View))) 5319foreach (View view in Enum.GetValues(typeof(View))) 5365foreach (View view in Enum.GetValues(typeof(View))) 5496foreach (View view in Enum.GetValues(typeof(View))) 5507foreach (View view in Enum.GetValues(typeof(View)))
System\Windows\Forms\MessageBoxTests.cs (3)
28foreach (MessageBoxButtons value in Enum.GetValues(typeof(MessageBoxButtons))) 71foreach (MessageBoxIcon value in Enum.GetValues(typeof(MessageBoxIcon))) 113foreach (MessageBoxDefaultButton value in Enum.GetValues(typeof(MessageBoxDefaultButton)))
System\Windows\Forms\NotifyIconTests.cs (1)
814foreach (ToolTipIcon tipIcon in Enum.GetValues(typeof(ToolTipIcon)))
System\Windows\Forms\PictureBoxTests.cs (2)
2485foreach (PictureBoxSizeMode sizeMode in Enum.GetValues(typeof(PictureBoxSizeMode))) 2556foreach (PictureBoxSizeMode sizeMode in Enum.GetValues(typeof(PictureBoxSizeMode)))
System\Windows\Forms\PowerStatusTests.cs (2)
32var values = Enum.GetValues(typeof(BatteryChargeStatus)) 67Assert.True(Enum.IsDefined(status.PowerLineStatus));
System\Windows\Forms\PreviewKeyDownEventArgsTests.cs (1)
33if (Enum.IsDefined(typeof(Keys), e.KeyValue))
System\Windows\Forms\ProgressBarTests.cs (2)
762foreach (ProgressBarStyle style in Enum.GetValues(typeof(ProgressBarStyle))) 2092foreach (ProgressBarStyle style in Enum.GetValues(typeof(ProgressBarStyle)))
System\Windows\Forms\RadioButtonTests.cs (6)
302foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 304foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 340foreach (ContentAlignment value in Enum.GetValues(typeof(ContentAlignment))) 1046foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 1098foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle))) 1202foreach (FlatStyle flatStyle in Enum.GetValues(typeof(FlatStyle)))
System\Windows\Forms\RichTextBoxTests.cs (2)
1815foreach (RichTextBoxLanguageOptions options in Enum.GetValues(typeof(RichTextBoxLanguageOptions))) 2907foreach (RichTextBoxScrollBars value in Enum.GetValues(typeof(RichTextBoxScrollBars)))
System\Windows\Forms\ScrollableControlTests.cs (10)
982foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1073foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1140foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1251foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1512foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 1584foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 1628foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 1784foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 1982foreach (ScrollEventType eventType in Enum.GetValues(typeof(ScrollEventType))) 1984foreach (ScrollOrientation orientation in Enum.GetValues(typeof(ScrollOrientation)))
System\Windows\Forms\ScrollBarTests.cs (2)
1766foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 1814foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified)))
System\Windows\Forms\SplitterTests.cs (1)
1167foreach (DockStyle childDock in Enum.GetValues(typeof(DockStyle)))
System\Windows\Forms\StatusStripTests.cs (8)
619foreach (ToolStripLayoutStyle layoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 645foreach (ToolStripLayoutStyle layoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 672foreach (ToolStripLayoutStyle layoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 761foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 892foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1127foreach (ToolStripLayoutStyle layoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 1129foreach (DockStyle dock in Enum.GetValues(typeof(DockStyle))) 1199foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft)))
System\Windows\Forms\SystemInformationTests.cs (3)
41Assert.True(Enum.IsDefined(bootMode)); 612Assert.True(Enum.IsDefined(alignment)); 652Assert.True(Enum.IsDefined(orientation));
System\Windows\Forms\TableLayoutPanel.TableLayoutPanelAccessibleObectTests.cs (1)
48Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\TableLayoutPanelTests.cs (2)
1410foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1412foreach (TableLayoutPanelCellBorderStyle cellBorderStyle in Enum.GetValues(typeof(TableLayoutPanelCellBorderStyle)))
System\Windows\Forms\TabPageTests.cs (9)
625TabAppearance parentAppearance = (TabAppearance)Enum.Parse(typeof(TabAppearance), parentAppearanceString); 3960foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 4008foreach (TabAppearance appearance in Enum.GetValues(typeof(TabAppearance))) 4014foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 4147foreach (TabAppearance appearance in Enum.GetValues(typeof(TabAppearance))) 4153foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 4259foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 4532foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 4686foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified)))
System\Windows\Forms\TextRendererTests.cs (8)
17foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 46foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 80foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 117foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 158foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 190foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 226foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint))) 266foreach (TextRenderingHint hint in Enum.GetValues(typeof(TextRenderingHint)))
System\Windows\Forms\ToolStrip.ToolStripAccessibleObjectWrapperForItemsOnOverflowTests.cs (1)
58Array roles = Enum.GetValues(typeof(AccessibleRole));
System\Windows\Forms\ToolStripButtonTests.cs (1)
1444foreach (ToolStripItemDisplayStyle displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle)))
System\Windows\Forms\ToolStripControlHostTests.cs (2)
955foreach (Enum displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle)))
System\Windows\Forms\ToolStripDropDownTests.cs (2)
4721foreach (ScrollEventType eventType in Enum.GetValues(typeof(ScrollEventType))) 4723foreach (ScrollOrientation orientation in Enum.GetValues(typeof(ScrollOrientation)))
System\Windows\Forms\ToolStripItemTests.cs (6)
2964foreach (Enum displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle))) 2990foreach (Enum displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle))) 10148foreach (DragDropEffects allowedEffects in Enum.GetValues(typeof(DragDropEffects))) 11323foreach (ToolStripItemDisplayStyle displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle)))
System\Windows\Forms\ToolStripRendererTests.cs (2)
28foreach (ArrowDirection arrowDirection in Enum.GetValues(typeof(ArrowDirection))) 196foreach (ToolStripItemImageScaling imageScaling in Enum.GetValues(typeof(ToolStripItemImageScaling)))
System\Windows\Forms\ToolStripSeparatorTests.cs (8)
309foreach (Enum displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle))) 816foreach (ToolStripLayoutStyle layoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 915foreach (ToolStripItemDisplayStyle displayStyle in Enum.GetValues(typeof(ToolStripItemDisplayStyle))) 1113foreach (ToolStripLayoutStyle layoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 1197foreach (ToolStripLayoutStyle ownerLayoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 1269foreach (ToolStripLayoutStyle ownerLayoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle))) 1271foreach (ToolStripLayoutStyle parentLayoutStyle in Enum.GetValues(typeof(ToolStripLayoutStyle)))
System\Windows\Forms\ToolStripTests.cs (11)
4794foreach (RightToLeft rtl in Enum.GetValues(typeof(RightToLeft))) 5853foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 5926foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 5978foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 6124foreach (ImageLayout backgroundImageLayout in Enum.GetValues(typeof(ImageLayout))) 6570foreach (ScrollEventType eventType in Enum.GetValues(typeof(ScrollEventType))) 6572foreach (ScrollOrientation orientation in Enum.GetValues(typeof(ScrollOrientation))) 6612foreach (ScrollEventType eventType in Enum.GetValues(typeof(ScrollEventType))) 6614foreach (ScrollOrientation orientation in Enum.GetValues(typeof(ScrollOrientation))) 6670foreach (ScrollEventType scrollEventType in Enum.GetValues(typeof(ScrollEventType))) 6715foreach (ScrollEventType scrollEventType in Enum.GetValues(typeof(ScrollEventType)))
System\Windows\Forms\TreeViewHitTestInfoTests.cs (1)
10foreach (TreeViewHitTestLocations hitLocation in Enum.GetValues(typeof(TreeViewHitTestLocations)))
System\Windows\Forms\UpDownBaseTests.cs (18)
1429foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 1431foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1460foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 1462foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1765foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 1767foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1769foreach (LeftRightAlignment upDownAlign in Enum.GetValues(typeof(LeftRightAlignment))) 1815foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 1817foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1819foreach (LeftRightAlignment upDownAlign in Enum.GetValues(typeof(LeftRightAlignment))) 1956foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 1958foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 1960foreach (LeftRightAlignment upDownAlign in Enum.GetValues(typeof(LeftRightAlignment))) 2227foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 2500foreach (BorderStyle borderStyle in Enum.GetValues(typeof(BorderStyle))) 2502foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 2504foreach (LeftRightAlignment upDownAlign in Enum.GetValues(typeof(LeftRightAlignment))) 2665foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified)))
TextBoxBaseTests.cs (2)
6448foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 6579foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified)))
TrackBarTests.cs (6)
1965foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 1967foreach (RightToLeft rightToLeft in Enum.GetValues(typeof(RightToLeft))) 2836foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 2838foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 2853foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified))) 2886foreach (BoundsSpecified specified in Enum.GetValues(typeof(BoundsSpecified)))
System.Windows.Forms.TestUtilities (8)
TrackBarTestHelper.cs (8)
18foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 32foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 55foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 77foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 101foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 123foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 137foreach (Orientation orientation in Enum.GetValues(typeof(Orientation))) 157foreach (Orientation orientation in Enum.GetValues(typeof(Orientation)))
System.Windows.Forms.UI.IntegrationTests (1)
Infra\ControlTestBase.cs (1)
122foreach (var code in Enum.GetValues<VIRTUAL_KEY>())
System.Xaml (1)
System\Windows\Markup\StaticExtension.cs (1)
103return Enum.Parse(type, fieldString);
TestProject.AppHost (2)
tests\testproject\Common\TestResourceNames.cs (2)
24if (Enum.TryParse<TestResourceNames>(resourceName, ignoreCase: true, out var name)) 39return string.Join(',', Enum.GetValues<TestResourceNames>()
TestProject.IntegrationServiceA (2)
tests\testproject\Common\TestResourceNames.cs (2)
24if (Enum.TryParse<TestResourceNames>(resourceName, ignoreCase: true, out var name)) 39return string.Join(',', Enum.GetValues<TestResourceNames>()
UIAutomationClient (1)
System\Windows\Automation\Text\TextRange.cs (1)
248obj = Enum.ToObject(ai.Type, (int)obj);
UIAutomationClientSideProviders (2)
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (1)
189if (targetAttribute is Enum)
MS\Internal\AutomationProxies\WindowsRichEditRange.cs (1)
443else if (v2 is Enum)
Wasm.Performance.ConsoleHost (1)
Scenarios\GridScenario.cs (1)
23? (GridRendering.GridRenderMode)Enum.Parse(typeof(GridRendering.GridRenderMode), _gridTypeOption.Value(), true)
WinFormsControlsTest (1)
MainForm.cs (1)
23Array mainFormControlsTabOrderItems = Enum.GetValues(typeof(MainFormControlsTabOrder));
xunit.console (1)
CommandLine.cs (1)
370if (!Enum.TryParse(option.Value, out ParallelismOption parallelismOption))