mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 19:38:47 +00:00
Explicit Ordinal string comparison
This commit is contained in:
parent
79129f44d2
commit
86458129b5
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using VpSharp.Internal.Attributes;
|
||||
|
||||
namespace VpSharp.Internal.ValueConverters;
|
||||
@ -13,7 +13,9 @@ internal sealed class StringToEnumConverter<T> : ValueConverter<T>
|
||||
{
|
||||
string value = reader.ReadToEnd();
|
||||
|
||||
FieldInfo? field = typeof(T).GetFields().FirstOrDefault(f => string.Equals(f.GetCustomAttribute<SerializationKeyAttribute>()?.Key, value));
|
||||
FieldInfo? field = typeof(T).GetFields().FirstOrDefault(f =>
|
||||
string.Equals(f.GetCustomAttribute<SerializationKeyAttribute>()?.Key, value, StringComparison.Ordinal));
|
||||
|
||||
if (field is not null)
|
||||
{
|
||||
result = (T)field.GetValue(Enum.GetValues<T>()[0])!;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading.Channels;
|
||||
using VpSharp.Entities;
|
||||
|
||||
@ -30,7 +30,7 @@ public sealed partial class VirtualParadiseClient
|
||||
|
||||
await foreach (VirtualParadiseWorld world in EnumerateWorldsAsync())
|
||||
{
|
||||
if (string.Equals(world.Name, name))
|
||||
if (string.Equals(world.Name, name, StringComparison.Ordinal))
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user