How can i use complextype class or multi type class is it generic collection?
Posted
by programmerist
on Stack Overflow
See other posts from Stack Overflow
or by programmerist
Published on 2010-04-15T10:19:37Z
Indexed on
2010/04/15
10:23 UTC
Read the original article
Hit count: 302
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
}
© Stack Overflow or respective owner