Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 6cbcd33

Browse files
author
Dusty Kline
committed
Switched out Linq.Contains() in favor of Array.IndexOf()
1 parent 3ed9e93 commit 6cbcd33

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/ServiceStack.Text/Common/ParseUtils.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//
1212

1313
using System;
14-
using System.Linq;
1514

1615
namespace ServiceStack.Text.Common
1716
{
@@ -67,10 +66,9 @@ public static object TryParseEnum(Type enumType, string str)
6766
if (JsConfig.EmitLowercaseUnderscoreNames)
6867
{
6968
string[] names = Enum.GetNames(enumType);
70-
if (!names.Contains(str)) // does this need StringComparer.InvariantCultureIgnoreCase?
69+
if (Array.IndexOf(names, str) == -1) // case sensitive ... could use Linq Contains() extension with StringComparer.InvariantCultureIgnoreCase instead for a slight penalty
7170
str = str.Replace("_", "");
7271
}
73-
7472

7573
return Enum.Parse(enumType, str, ignoreCase: true);
7674
}

0 commit comments

Comments
 (0)