.NET result options

There are multiple ways to work with the results returned by the 1010data .NET SDK.

Casting to a DataTable

You can export a small result set with the .NET object DataTable.

In the following example, the CrossSection method is used to take a portion of the Table object and cast it to a DataTable.

using(Session s = new Session(gateway, user, pwd, LoginType.POSSESS)) {
    var q = new Query(tablename, ops);
    using(Table t = q.RunOn(s)) {
        Console.WriteLine("Exporting to .NET DataFrame...");
        DataTable dt = t.CrossSection(0, Math.Min(t.Rows.Count, 500));
        foreach(var z in dt.Rows) {
            Console.WriteLine(z);
        }
    }
}

Using IQueryable

While none of the .NET SDK Objects implement the IQueryable interface LINQ allows you to treat an Object that implements IEnumerable in much the same way. If you want to leverage the LINQ IQueryable-like features, you can use the RowSet object. The RowSet object is a collection of the table's rows, and it implements the IEnumerable interface. There is a possible runtime performance issue, because it downloads the entire dataset into memory before the LINQ query is performed.

Scrolling through a large data set

All of the objects that access data in the .NET SDK implement IEnumerable. This interface enables you to enumerate through the results, even if they are too large to fit in memory. Most of the examples in this document access data in this fashion.