Sunday, July 27, 2014

How to create objects dynamically by passing type in c#?

Try an enum



enum myType
{
Products,
Categories,
Customers
}
Dictionary<myType, string> dict = new Dictionary<myType, string>()
{
{myType.Products,"Products"},
{myType.Categories, "Categories"},
{myType.Customers, "Customers"}
};





jdweng


No comments:

Post a Comment