Array.CreateInstance is likely to be helpful: https://learn.microsoft.com/en-us/dotnet/api/system.array.createinstance?view=net-9.0