我有以下内容:
using (ISession session = Config.SessionFactory.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
// This is a System.Collections.ArrayList,contains all my records returned from the session
var list = session.CreateSQLQuery(selectQuery).List();
// I want to put these records in an ObservableCollection of a specific Type
// Something like htis:
MyCollection = new ObservableCollection<MyType>(list);
}
}
这是行不通的,这里不能选择强制转换。有没有办法将我返回的列表放入 ObservableCollection?