Skip to content

Commit 9998fb5

Browse files
committed
code suggestion
1 parent 3fa6f91 commit 9998fb5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Caliburn.Micro.Platform/Platforms/uap/XamlMetadataProvider.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,13 @@ public override object CreateFromString(String input)
426426
}
427427
catch (FormatException)
428428
{
429-
foreach (var key in _enumValues.Where(kvp => String.Equals(trimmedValue, kvp.Key, StringComparison.OrdinalIgnoreCase)))
429+
var key = _enumValues.FirstOrDefault(kvp => String.Equals(trimmedValue, kvp.Key, StringComparison.OrdinalIgnoreCase));
430+
431+
if (key.Value != null)
430432
{
431433
enumFieldValue = Convert.ToInt32(key.Value);
432-
break;
433434
}
435+
434436
}
435437
}
436438

0 commit comments

Comments
 (0)