mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-08 16:36:15 +00:00
Specific case first, fallback to insensitive
This commit is contained in:
parent
d80e9b9c3f
commit
4e5c551413
@ -71,7 +71,11 @@ namespace CryptoExchange.Net.Converters
|
|||||||
|
|
||||||
private bool GetValue(string value, out T result)
|
private bool GetValue(string value, out T result)
|
||||||
{
|
{
|
||||||
var mapping = Mapping.FirstOrDefault(kv => kv.Value.Equals(value));
|
//check for exact match first, then if not found fallback to a case insensitive match
|
||||||
|
var mapping = Mapping.FirstOrDefault(kv => kv.Value.Equals(value, StringComparison.InvariantCulture));
|
||||||
|
if(mapping.Equals(default(KeyValuePair<T, string>)))
|
||||||
|
mapping = Mapping.FirstOrDefault(kv => kv.Value.Equals(value, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
|
||||||
if (!mapping.Equals(default(KeyValuePair<T, string>)))
|
if (!mapping.Equals(default(KeyValuePair<T, string>)))
|
||||||
{
|
{
|
||||||
result = mapping.Key;
|
result = mapping.Key;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user