Remove generic type suffix properly

This commit is contained in:
Hisham Bin Ateya 2022-06-08 00:12:10 +03:00
parent 227331bf24
commit b22f8a0b02

View File

@ -32,10 +32,10 @@ namespace Oqtane.Modules.Controls
var controlTypeName = controlType.Name;
var assemblyName = controlType.Assembly.GetName().Name;
// Trim "`1" suffix (for generic type) to make it consistent like normal control types
if (controlTypeName.EndsWith("`1"))
if (controlType.IsGenericType)
{
controlTypeName = controlTypeName.TrimEnd('`', '1');
// Trim generic type suffix
controlTypeName = controlTypeName[..controlTypeName.IndexOf('`')];
}
controlTypeName = controlType.FullName[..(controlType.FullName.IndexOf(controlTypeName) + controlTypeName.Length)];