From a73d710bec203997c15d4dbeb6e978a965188223 Mon Sep 17 00:00:00 2001 From: penev92 Date: Tue, 26 Apr 2022 01:47:51 +0300 Subject: [PATCH] Added Util.InternalTypeName() --- OpenRA.Mods.Common/Util.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenRA.Mods.Common/Util.cs b/OpenRA.Mods.Common/Util.cs index d7628260a0..240a6220de 100644 --- a/OpenRA.Mods.Common/Util.cs +++ b/OpenRA.Mods.Common/Util.cs @@ -226,6 +226,13 @@ namespace OpenRA.Mods.Common 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) { if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(HashSet<>))