Skip to content

Commit ab3c6cc

Browse files
committed
fix: Correctly find particular string attributes with matching context
This function is unused but is useful
1 parent aacd11b commit ab3c6cc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Source/Orts.Common/GetStringAttribute.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ public class GetParticularStringAttribute : GetStringAttribute
5252
public static string GetParticularPrettyName(string context, Enum value)
5353
{
5454
var type = value.GetType();
55-
string toBeReturned = type.GetField(Enum.GetName(type, value))
55+
return type.GetField(Enum.GetName(type, value))
5656
.GetCustomAttributes(false)
5757
.OfType<GetParticularStringAttribute>()
58-
.SingleOrDefault()
58+
.FirstOrDefault(attribute => attribute.Context == context)
5959
.Name;
60-
61-
return toBeReturned;
6260
}
6361
}
6462
}

0 commit comments

Comments
 (0)