views:

139

answers:

1

I have an NHibernate ISQLQuery.List()

ISQLQuery sqlQuery = session.CreateSQLQuery(query);
IList tags = sqlQuery.List();

where the results in "tags" are an object[] containing 2 child objects.

[0] {object[2]} object {object[]}
  [0]   1 object {int}
  [1]   "irregular" object {string}
[1] {object[2]} object {object[]}
  [0]   2 object {int}
  [1]   "irregular mass" object {string}

I can loop through the outer objects w/

foreach(var item in tags)
{
  //How to access values in item?
}

but how do I get the values from each item, e.g. 1 and "irregular" etc.

Any thoughts appreciated.

+1  A: 

Have you tried doing something like this?

foreach(var item in tags)
{
  int field1 = (int)item[0];
  string field2 = (string)item[1];

  // ...
}
dahlbyk
Thanks. I ended up w/ that sort of approach.
ChrisP