private static void Map(DataFrameRow from, object to, Tuple <DataFrameColumnAttribute, MethodInfo>[] tuples) { var names = from.DataFrame.ColumnNames; foreach (var t in tuples) { var attribute = t.Item1; var setter = t.Item2; var index = attribute.GetIndex(names); setter.Invoke(to, new object[] { from.GetInnerValue(index) }); } }
internal TRow Convert <TRow>(DataFrameRow row) where TRow : class, new() { var rowType = typeof(TRow); Map map; if (!this.cache.TryGetValue(rowType, out map)) { map = CreateMap(rowType); this.cache.Add(rowType, map); } var result = Activator.CreateInstance(rowType); map(row, result); return((TRow)result); }