Replace F extension with string interpolation
This commit is contained in:
@@ -212,19 +212,22 @@ namespace OpenRA.Mods.Common
|
||||
public static string FriendlyTypeName(Type t)
|
||||
{
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(HashSet<>))
|
||||
return "Set of {0}".F(t.GetGenericArguments().Select(FriendlyTypeName).ToArray());
|
||||
return $"Set of {t.GetGenericArguments().Select(FriendlyTypeName).ToArray()}";
|
||||
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Dictionary<,>))
|
||||
return "Mapping of {0} to {1}".F(t.GetGenericArguments().Select(FriendlyTypeName).ToArray());
|
||||
{
|
||||
var args = t.GetGenericArguments().Select(FriendlyTypeName).ToArray();
|
||||
return $"Dictionary with Key: {args[0]}, Value {args[1]}";
|
||||
}
|
||||
|
||||
if (t.IsSubclassOf(typeof(Array)))
|
||||
return "Collection of {0}".F(FriendlyTypeName(t.GetElementType()));
|
||||
return $"Collection of {FriendlyTypeName(t.GetElementType())}";
|
||||
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition().GetInterfaces().Any(e => e.IsGenericType && e.GetGenericTypeDefinition() == typeof(IEnumerable<>)))
|
||||
return "Collection of {0}".F(FriendlyTypeName(t.GetGenericArguments().First()));
|
||||
return $"Collection of {FriendlyTypeName(t.GetGenericArguments().First())}";
|
||||
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||
return "{0} (optional)".F(t.GetGenericArguments().Select(FriendlyTypeName).First());
|
||||
return $"{t.GetGenericArguments().Select(FriendlyTypeName).First()} (optional)";
|
||||
|
||||
if (t == typeof(int) || t == typeof(uint))
|
||||
return "Integer";
|
||||
|
||||
Reference in New Issue
Block a user