Ejemplo n.º 1
0
        public void Init(object data)
        {
            var type      = PFDataHelper.GetGenericType(data);
            var tableName = PFDataHelper.IsDynamicType(type) ? string.Empty : type.Name;

            table = new DataTable(tableName);
            PFDataHelper.EachListHeader(data, (rowIndex, name, cellType) =>
            {
                string typeName = cellType.ToString();
                if (cellType.IsGenericType)
                {
                    typeName = cellType.GetGenericArguments()[0].ToString();
                }

                Type newType = Type.GetType(typeName, false);
                if (newType != null)
                {
                    table.Columns.Add(name, newType);
                }
            });
            table.BeginLoadData();
            title = new List <string>();
        }