minhhungit / ConsoleTableExt

A fluent library to print out a nicely formatted table in a console application C#
MIT License
333 stars 37 forks source link

"Parameter count mismatch" exception when passing lists of strings #42

Closed palenshus closed 4 months ago

palenshus commented 4 months ago
var tableData = new List<List<string>>
{
    new List<string>{ "Sakura Yamamoto", "Support Engineer", "London", 46.ToString(), ""},
    new List<string>{ "Serge Baldwin", "Data Coordinator", "San Francisco", 28.ToString(), "something else" },
    new List<string>{ "Shad Decker", "Regional Director", "Edinburgh", "", ""},
};

ConsoleTableBuilder
    .From(tableData)
    .Export();

Results in:

System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at System.Reflection.MethodBaseInvoker.ThrowTargetParameterCountException()
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.PropertyInfo.GetValue(Object obj)
   at ConsoleTableExt.ConsoleTableBuilder.From[T](List`1 list)
minhhungit commented 4 months ago

@palenshus pls use List<List<object>> for now

palenshus commented 4 months ago

Will do, thanks

minhhungit commented 4 months ago

I released version 3.3.0 to handle this issue, thank you for reporting

https://www.nuget.org/packages/ConsoleTableExt/3.3.0

minhhungit commented 4 months ago

@palenshus