49 references to TryParse
Aspire.Dashboard (2)
Otlp\Model\OtlpSpan.cs (1)
168if (!string.IsNullOrEmpty(grpcStatusCode) && Enum.TryParse<StatusCode>(grpcStatusCode, out var statusCode))
ServiceClient\Partials.cs (1)
38KnownState = HasState ? Enum.TryParse(State, out KnownResourceState knownState) ? knownState : null : null,
dotnet-openapi (1)
Commands\BaseCommand.cs (1)
430if (!Enum.TryParse(value, out CodeGenerator _))
GetDocument.Insider (1)
Commands\GetDocumentCommandWorker.cs (1)
340if (Enum.TryParse<OpenApiSpecVersion>(_context.OpenApiVersion, out var version))
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.AspNetCore.Components (2)
BindConverter.cs (2)
1613if (!Enum.TryParse<T>(text, out var converted)) 1638if (!Enum.TryParse<T>(text, out var converted))
Microsoft.AspNetCore.Http.Connections.Client (1)
HttpConnection.cs (1)
367if (!Enum.TryParse<HttpTransportType>(transport.Transport, out var transportType))
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
DefaultHtmlGenerator.cs (1)
1399if (Enum.TryParse(value, out TEnum enumValue))
Microsoft.CodeAnalysis.Analyzers (2)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (2)
1131Enum.TryParse(fieldReference.Field.Name, out DiagnosticSeverity parsedSeverity)) 1142Enum.TryParse(fieldReference2.Field.Name, out RuleLevel parsedRuleLevel))
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.Features (1)
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
101if (!Enum.TryParse(operationLocationString, out UseUtf8StringLiteralDiagnosticAnalyzer.ArrayCreationOperationLocation operationLocation))
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Workspace\LanguageServices\CSharpCompilationFactoryService.cs (1)
48!Enum.TryParse<OutputKind>(outputKindString, out var outputKind))
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Extensions\ProtocolConversions.cs (2)
546if (Enum.TryParse<LSP.SymbolKind>(kind, out var symbolKind)) 651if (Enum.TryParse<LSP.SymbolKind>(glyphString, out var symbolKind))
Microsoft.CodeAnalysis.Rebuild (1)
MetadataCompilationOptions.cs (1)
64public static T? ToEnum<T>(string value) where T : struct => Enum.TryParse<T>(value, out var enumValue) ? enumValue : null;
Microsoft.CodeAnalysis.Workspaces (2)
CodeFixesAndRefactorings\EnumArrayConverter.cs (1)
18if (!Enum.TryParse(s, out TEnum enumValue))
Editing\DeclarationModifiers.cs (1)
234if (Enum.TryParse(value, out Modifiers mods))
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
Host\LanguageServices\TestCSharpCompilationFactoryServiceWithIncrementalGeneratorTracking.cs (1)
50!Enum.TryParse<OutputKind>(outputKindString, out var outputKind))
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.Manifest (1)
ArtifactModel.cs (1)
60else if (Enum.TryParse(val, out ArtifactVisibility visibility))
Microsoft.DotNet.Build.Tasks.Packaging (1)
ValidationTask.cs (1)
115if (!Enum.TryParse<Suppression>(keyString, out key))
Microsoft.DotNet.SignCheckTask (2)
src\SignCheck.cs (1)
146if (Enum.TryParse<FileStatus>(value, out result))
src\SignCheckTask.cs (1)
177if(Enum.TryParse<LogVerbosity>(Verbosity, out LogVerbosity verbosity))
Microsoft.DotNet.SignTool (1)
src\SignToolTask.cs (1)
617return Enum.TryParse<ExecutableType>(executableType, out var type);
Microsoft.Extensions.AI.Evaluation.Integration.Tests (1)
ResultsTests.cs (1)
140if (!Enum.TryParse(e.Value, out MeasurementSystem measurementSystem))
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 (1)
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;
Microsoft.Maui.Controls (3)
FlowDirectionConverter.cs (1)
22 if (Enum.TryParse(strValue, out FlowDirection direction))
FontSizeConverter.cs (1)
96 if (Enum.TryParse(strValue, out NamedSize namedSize))
TextAlignment.cs (1)
38 if (Enum.TryParse(strValue, out TextAlignment direction))
Microsoft.Maui.Controls.Build.Tasks (2)
CompiledConverters\EnumTypeConverter.cs (1)
16 if (Enum.TryParse(value, out TEnum enumValue))
CompiledConverters\FontSizeTypeConverter.cs (1)
26 if (Enum.TryParse(value, out NamedSize namedSize))
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.CodeGenerator (1)
CodeGenerator\CSharp\TransformGeneratorFactory.cs (1)
84if (Enum.TryParse(node.Name, out SpecialTransformer transformer))
Microsoft.ML.InternalCodeAnalyzer (1)
NameFixProvider.cs (1)
56if (!Enum.TryParse(desiredNameStr, out desiredName))
PresentationBuildTasks (1)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\SystemResourceKey.cs (1)
408Enum.TryParse(srkField, out SystemResourceKeyID srkId))
PresentationCore (1)
MS\Internal\FontFace\CompositeFontParser.cs (1)
333if (Enum.TryParse(_reader.GetAttribute("OS"), out fontFamilyOsVersion)
PresentationFramework (1)
System\Windows\SystemResourceKey.cs (1)
408Enum.TryParse(srkField, out SystemResourceKeyID srkId))
SocialWeather (1)
Pipe\PipeWeatherStreamFormatter.cs (1)
31if (tokens.Length < 2 || !Enum.TryParse<Weather>(tokens[1], out weather))
xunit.console (1)
CommandLine.cs (1)
370if (!Enum.TryParse(option.Value, out ParallelismOption parallelismOption))