Linq doesn't know what types it should use - so when you iterate a DataTable and
select
items it returns DataRow items which don't have any casting operations to your own classes! Instead, create a
createUserModel
constructor that accepts a DataRow and select that instead:
var query = (from n in ds.Tables["User"].AsEnumerable()
where n.Field<string>("userName") == obj.UserName
select new createUserModel(n));
List<createUserModel> checkList = query.ToList();