The Imperative API provides a set of methods that enable you to work with DataSet in a way similar to a procedural API. The goal of the extensions is to enable simple data operations with a minimum amount of code. Additionally, it unifies the API with other languages like C, R, Python etc. Note that these are just helper methods that call the universal object model API.

This page briefly descibes the methods. For a complete reference, see the documentation included in the release.
Assembly and namespace
The Imperative API is located in Microsoft.Research.Science.Data.Imperative assembly in namespace with the same name. Following using directive should be added to C# source files in order to use Imperative API.

using Microsoft.Research.Science.Data.Imperative;
Range methods
These methods are static methods of the DataSet class. They produce an instance of type Range.
The following methods are methods for the class DataSet and are defined in the Microsoft.Research.Science.Data.Imperative.DataSetExtensions class (assembly Microsoft.Research.Science.Data.Imperative).
Add methods
ds.Add<double[,]>("mat") // Creates a variable named "mat" of type double and of rank 2 depending on default dimensions
ds.Add<double>("mat", "x", "y") // Also creates a variable named "mat" of type double and of rank 2 depending on "x","y" 
ds.Add<double[,]>("mat", "x", "y") // Does the same
ds.Add<double[,]>("mat", new double[,]{{1},{2}}); // Creates a variable named "mat" of type double and of rank 2
ds.Add<double[,]>("mat", new double[,]{{1},{2}}, "x", "y"); // Creates a variable named "mat" of type double and of rank 2 depending on "x","y"
// ds.Add<double>("mat", new double[,]{{1},{2}}, "x", "y") // It is incorrect!
ds.Add<double>("mat", 10.0); // Creates a scalar variable with value 10.0
PutData methods
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Updates a variable that satisfies the predicate:
ds.PutData(v => v.Metadata["action"] == "toUpdate", new int[] { 9, 8, 7, 6 });
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=create");        
var id = ds.Add<int[]>("int1").ID;
// Updates a one-dimensional variable with given id:
ds.PutData(id, new int[] { 9, 8, 7, 6 });
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Updates a one-dimensional variable with name "int1" and type of data int:
ds.PutData("int1", new int[] { 9, 8, 7, 6 });
// Creates new data set:
var ds = DataSet.Open("test.csv?openMode=create");
// Adds a new variable with name "int1" that is a one-dimensional array of int and depends on dimension "idx".
// id2 contains the unique identifier of the new variable.
int id2 = ds.Add<int[]>("int1", "idx").ID;
// Sets the first element of the id2 to 7:
ds.PutData(id2, 7, 0);
// Let variable "var2d" has rank 2
ds.PutData<double[]>( "var2d", new double[] { 1, 2, 3 }, 
 DataSet.Range(0,2), // 1st dim: from 0 to 2
 DataSet.ReduceDim(1)); // 2nd dim is reduced in the input data set and its index is 1.

Examples
// Creates a new data set:
var ds = DataSet.Open("test.csv?openMode=create");

// Adds a new string scalar variable with name "str" to the data set:
ds.Add<string>("str"); 

// Data for the variable "str" is "data string":
ds.PutData("str", "data string");

// Adds a new variable with name "int1" that is a one-dimensional array of int and depends on dimension "idx".
// id2 contains the unique identifier of the new variable.
int id2 = ds.Add<int[]>("int1", "idx").ID;

// Data of the variable "int1" is { 9, 8, 7, 6 }:
ds.PutData(id2, new int[] { 9, 8, 7, 6 });

// Adds a new variable "double2" depending on two dimensions:
ds.Add<double>("double2", "i1", "i2");

// Adds a new variable "double3" depending on 3 default dimensions:
ds.Add<double[, ,]>("double3");

// Displays the data set brief description:
Console.WriteLine(ds);
Append methods
// Creates new data set:
var ds = DataSet.Open("test.csv?openMode=create");
// Adds a new variable with name "int1" that is a one-dimensional array of int and depends on dimension "idx".
// id2 contains the unique identifier of the new variable.
int id2 = ds.Add<int[]>("int1", "idx").ID;
// Data of the variable "int1" is { 9, 8, 7, 6 }:
ds.PutData(id2, new int[] { 9, 8, 7, 6 });
// Appends one more value to the end of the variable:
ds.Append(id2, 5);
// Now id2 contains { 9, 8, 7, 6, 5 }
GetData methods
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Gets a value from a scalar variable of type double with given id:
int varID = ...;
double val = ds.GetData<double>(varID); 
// Gets an array from a one-dimensional variable of type string:
int var2ID = ...;
string[] strings = ds.GetData<string[]>(var2ID);
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Gets a value from a scalar variable of type double with given id:
int varID = ...; // id of 3d variables
double[,,] val3d = ds.GetData<double[,,]>(varID); // Gets all data.
double[,] val2d = ds.GetData<double[,]>(varID, 
     DataSet.ReduceDim(0), // First index is 0 and reduced from output array
     DataSet.Range(0, 3, 100), // Takes every third element by 2nd dimension
     DataSet.FromToEnd(100)); // Takes all elements starting with index 100
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Gets a value from a scalar variable named "str" of type string:
string val = ds.GetData<double>("str"); 
// Gets the 3rd (index starts from zero) value from a one-dimensional variable named "int1" of type int:
int data = ds.GetData<int>("int1", 2);
PutAttr methods
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Sets attribute "range" of variable "var":
ds.PutAttr("var", "range", new int[] { 0, 100 });
GetAttr methods
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Gets attribute "range" from variable "var":
object range = ds.GetAttr("var", "range");
// Opens a data set:
var ds = DataSet.Open("test.csv?openMode=open");        
// Gets attribute "range" from variable "str":
int[] range = ds.GetAttr<int[]>("str", "range"); 
int min = range[0];
int max = range[1];