Невозможно отменить объект типа
'system.collections.generic.list
Код: Выделить всё
1[System.Object]' to type 'System.Collections.Generic.List
Calling Code -
ArrayList arrayList = BusinessLayer.GetData();
List tempList = (List)arrayList[0];
< /code>
называется кодовая логика -< /p>
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);
}
< /code>
Я возвращаю ArrayList и хочу вернуть данные при вызове кода. Я не хочу использовать модель в Cay Code. Я понимаю, что мы можем использовать модель в COMAD CODE, но я должен проверить, можно ли использовать ArrayList, можем ли мы вернуть данные? Я надеюсь, что я ясно объяснил.>
Подробнее здесь: https://stackoverflow.com/questions/705 ... tem-object