Ejemplo n.º 1
0
        public static void Remove([NotNull] this DataTableCollection thisValue, [NotNull] Predicate <DataTable> selector)
        {
            if (thisValue.Count == 0)
            {
                return;
            }

            string[] names = thisValue.Cast <DataTable>().Where(t => selector(t)).Select(t => t.TableName).ToArray();
            Remove(thisValue, names);
        }
Ejemplo n.º 2
0
 private void popoloWs(DataSet excO)
 {
     cbWorkSheet.Items.Clear();
     dtbc = excO.Tables;
     cbWorkSheet.Items.AddRange(dtbc.Cast <DataTable>().Select(t => t.TableName).ToArray <string>());
 }
 /// <id>0F8B7690-B992-4278-A104-DC05AF97191D</id>
 /// <summary>
 ///     A DataTableCollection extension method that converts the @this to an IEnumerable.
 /// </summary>
 /// <param name="this">The @this to act on.</param>
 /// <returns>@this as an IEnumerable.</returns>
 public static IEnumerable <DataTable> AsEnumerable(this DataTableCollection @this)
 {
     return(@this.Cast <DataTable>());
 }
 public static DataTable GetTable(this DataTableCollection tables, string tableName) =>
 tables == null ? new DataTable() :
 tables
 .Cast <DataTable>()
 .FirstOrDefault(x => x.TableName.ToLower() == tableName.ToLower());
 /// <id>AA7134EC-AD33-4669-AC55-5EA7EF765373</id>
 /// <summary>
 ///     A DataTableCollection extension method that converts the @this to a list.
 /// </summary>
 /// <param name="this">The @this to act on.</param>
 /// <returns>@this as a List&lt;DataTable&gt;</returns>
 public static List <DataTable> ToList(this DataTableCollection @this)
 {
     return(@this.Cast <DataTable>().Select(x => x).ToList());
 }