The following code example shows how to use the ColumnSet class to specify what attributes to return from a query expression.
QueryExpression contactquery = new QueryExpression { EntityName="contact", ColumnSet = new ColumnSet("firstname", "lastname", "contactid") };