Невозможно привести объект типа
'System.Collections.Generic.List
Код: Выделить всё
1[System.Object]' to type 'System.Collections.Generic.Listкод вызова -
Код: Выделить всё
ArrayList arrayList = BusinessLayer.GetData();
List tempList = (List)arrayList[0];
Код: Выделить всё
if (connection.State == System.Data.ConnectionState.Closed)
connection.Open();
var command = connection.CreateCommand();
command.CommandText = "EXEC SP_GET_DATA @id";
command.Parameters.Add(new SqlParameter("@id", id));
using (var reader = command.ExecuteReader())
{
var customTypeList = ((IObjectContextAdapter)context)
.ObjectContext
.Translate(reader)
.ToList();
arrayList.Add(customTypeList);
reader.NextResult();
var customType2List = ((IObjectContextAdapter)context)
.ObjectContext
.Translate(reader)
.ToList();
arrayList.Add(customType2List);
}
здесь я пытаюсь привести List из ArrayList к List
Подробнее здесь: https://stackoverflow.com/questions/705 ... tem-object
Мобильная версия