Skip to content

Commit

Permalink
Fix schema binding signature in "ToDataTable" implementation
Browse files Browse the repository at this point in the history
atifaziz committed Jun 25, 2023
1 parent f59f7a5 commit d739f65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MoreLinq/ToDataTable.cs
Original file line number Diff line number Diff line change
@@ -103,8 +103,8 @@ public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable t
expressions ??= EmptyArray<Expression<Func<T, object?>>>.Value;

var members = PrepareMemberInfos(expressions).ToArray();
members = BuildOrBindSchema(table, members);
var shredder = CreateShredder<T>(members);
var boundMembers = BuildOrBindSchema(table, members);
var shredder = CreateShredder<T>(boundMembers);

//
// Builds rows out of elements in the sequence and
@@ -180,7 +180,7 @@ static MemberInfo GetAccessedMember(LambdaExpression lambda)
/// columns for which there is no source member supplying a value.
/// </remarks>

static MemberInfo[] BuildOrBindSchema(DataTable table, MemberInfo[] members)
static MemberInfo?[] BuildOrBindSchema(DataTable table, MemberInfo[] members)
{
//
// Retrieve member information needed to
@@ -227,7 +227,7 @@ var type when Nullable.GetUnderlyingType(type) is { } ut => ut,
};
}

static Func<T, object[]> CreateShredder<T>(IEnumerable<MemberInfo> members)
static Func<T, object[]> CreateShredder<T>(MemberInfo?[] members)
{
var parameter = Expression.Parameter(typeof(T), "e");

0 comments on commit d739f65

Please sign in to comment.