PDA

View Full Version : مشکل این Pattern و Interface چیه؟



armin656
یک شنبه 24 مرداد 1395, 11:49 صبح
public class AA : IABC
{
public string z {get; set;}
}
public class BB : IABC
{
public int x {get; set;}
}
public interface IABC
{

}
public interface IFoodFacts<T> where T : IABC
{
List<T> GetReport(WS_GroupsFilterDTO Filter_OBJ, ref ReportInfoDTO rptInfo);
}
public class FoodFactsFactory
{
public IFoodFacts<IABC> GetFoodFactsInstance(ReportingType.rpt_FoodFacts WhichReport)
{
switch (WhichReport)
{
case 1 :
case 2 :
return new WeeklySeparating(WhichReport);
}
return null;
}
}

public class WeeklySeparating : IFoodFacts<AA>
{
public List<AA> GetReport(WS_GroupsFilterDTO Filter_OBJ, ref ReportInfoDTO rptInfo)
{
return null;
}
}


در قسمت switch case خطای convert type رو میده

aryaei2000
یک شنبه 24 مرداد 1395, 15:15 عصر
سلام

این از چه نوعیه؟ ReportingType.rpt_FoodFacts

اگر نوع عددی نیست تبدیل نیاز داره.

ژیار رحیمی
یک شنبه 24 مرداد 1395, 15:21 عصر
دوست گرامی نوع برگشتی تابع WeeklySeparating(WhichReport) از نوع List<AA> هست و این با نوع برگشتی تابع GetFoodFactsInstance که IFoodFacts<IABC>متفاوت هست.