Я пытаюсь выполнить приведение к списку из результата хранимой процедуры. Я уже создал явное (рабочее) приведение для одного объекта timerangeResult -> Booking, но мне не хватает списка..
Вот код:
public static explicit operator List<Booking>(timerangeResult t)
{
List<Booking> bL = new List<Booking>();
IEnumerable<timerangeResult> tx = (IEnumerable<timerangeResult>) t;
foreach (timerangeResult tt in tx)
{
Booking b = (Booking)tt;
bL.Add(b);
}
//return bL;
//return new List<Booking>(bL);
//return new List<Booking>(IEnumerable < Booking > bL);
return bL;
// [NONE OF THESE WORK]
// ERROR:
// User-defined conversion must convert to or from the enclosing type (UNDERLINED: "explicit operator List<Booking>" line 1)
}
Заранее спасибо!
timerangeResult
вIEnumerable<timerangeResult>
. - person Cheng Chen   schedule 07.12.2010