Added Util.InternalTypeName()

This commit is contained in:
penev92
2022-04-26 01:47:51 +03:00
committed by Matthias Mailänder
parent 9ed2e699c6
commit a73d710bec

View File

@@ -226,6 +226,13 @@ namespace OpenRA.Mods.Common
return random.Next(range[0], range[1]); return random.Next(range[0], range[1]);
} }
public static string InternalTypeName(Type t)
{
return t.IsGenericType
? $"{t.Name.Substring(0, t.Name.IndexOf('`'))}<{string.Join(", ", t.GenericTypeArguments.Select(arg => arg.Name))}>"
: t.Name;
}
public static string FriendlyTypeName(Type t) public static string FriendlyTypeName(Type t)
{ {
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(HashSet<>)) if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(HashSet<>))