How can i use complextype class or multi type class is it generic collection?
- by programmerist
i need a complex returning type. i have 4 class returning types COMPLEXTYPE must include Company, Muayene, Radyoloji, Satis because i must return data switch case situation how can i do? Maybe i need generic collections How can i do that?
public class GenoTipController
{
public COMPLEXTYPE Generate(DataModelType modeltype)
{
_Company company = null;
_Muayene muayene = null;
_Radyoloji radyoloji = null;
_Satis satis = null;
switch (modeltype)
{
case DataModelType.Radyoloji:
radyoloji = new Radyoloji();
return radyoloji;
break;
case DataModelType.Satis:
satis = new Satis();
return satis;
break;
case DataModelType.Muayene:
muayene = new Muayene();
return muayene;
break;
case DataModelType.Company:
company = new Company();
return company;
break;
default:
break;
}
}
}
public class CompanyView
{
public static List GetPersonel()
{
GenoTipController controller = new GenoTipController();
_Company company = controller.Generate(DataModelType.Company);
return company.GetPersonel();
}
}
public enum DataModelType
{
Radyoloji,
Satis,
Muayene,
Company
}