Click here to Skip to main content
14,693,616 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi guys, am working in a accounting project. In my account class we have a AccountType as enumeration...
class Account
{
.....
        enum 
	{
		None       = -1,
		Cash       = 0,
		Saving     = 1,
		CreditCard = 2,
		Checking   = 3,
		Investment = 4,
		Mortgage   = 5
	};
......

};

and database also contains AccountType table. We are upgrading our product through web using some script. My task is when the script add more fields int the AccountType table the enum in Account class also need to update that value.

In my search i found enumerations are compile time constants, so how can i achieve this , if any other possibility is there pls guide me with your valuable ideas.

Thanks in advance
ganesh_IT
Posted

1 solution

You can't dynamically create enums. What you SHOULD do is create a HashSet (do you have a HashSet colleciton in unmanaged C++? I haven't kept up with it since moving to .Net) in of account types that are loaded from the database, and use that instead of an enum.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900