2
Vote

Supplied properties in parameter Properties must be of the same type as T

description

First of all I'd like to thank you for this great plugin.

In the following file,
EPPlus\ExcelRangeBase.cs
the following method,
public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders, TableStyles TableStyle, BindingFlags memberFlags, MemberInfo[] Members)
There is this following code which is throwing an exception when passing a dynamic object T with known MemberInfos.
var type = typeof(T);
if (Members == null)
{
    Members = type.GetProperties(memberFlags);
}
else
{
    foreach (var t in Members)
    {
        if (t.DeclaringType != type)
        {
            throw (new Exception("Supplied properties in parameter Properties must be of the same type as T"));
        }
    }
}
Currently I have commented this code and importing the whole source code in my solution. If the 'else' part is commented out all is working well even with dynamic objects.

Do you think you could comment the else part and update the nuget? if not why do you have to check the types of individual properties? This would not allow dynamic objects to be passed using dynamic keyword.

Please let me know.

Thank you.

comments