Projections enable the returning of something other than a list of entities from a query.
var proj = Projections.ProjectionList()
.Add(Projections.Property("Id"), "Id")
.Add(Projections.Property("Username"), "Username");
var list2 = DetachedCriteria.For<User>()
.Add(Expression.Eq("Username", "lachlan"))
.GetExecutableCriteria( sessionFactory.GetCurrentSession())
.SetProjection( proj )
.List();
NHibernate can also map the projected result to a typed list.
var proj = Projections.ProjectionList()
.Add(Projections.Property("Id"), "First")
.Add(Projections.Property("Username"), "Second");
var list2 = DetachedCriteria.For<User>()
.Add(Expression.Eq("Username", "lachlan"))
.GetExecutableCriteria( sessionFactory.GetCurrentSession())
.SetProjection( proj )
.SetResultTransformer(Transformers.AliasToBean(typeof(Pair)))
.List<Pair>();