hi
i have a sql statment and it will execute using CreateSQLQuery command
i want to return the customer list using IList<Customer>;
i convert the IList into IList<T> object.
but its get following error
"Unable to cast object of type 'System.Object[]' to type Customer"
Code like this :
public IList<Customer> Execute()
{
string sqlString="Select * from Customer";
IList list = _session.CreateSQLQuery(sqlString).List();
IList<Customer> CustomerList= ConvertToListOf<Customer>(list);
retun CustomerList;
}
public static IList<T> ConvertToListOf<T>(IList iList)
{
IList<T> result = new List<T>();
foreach (T value in iList)
result.Add(value);
return result;
}
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.