Hi,
i won´t declare an enum NumberFormat{hundredth, thousandth} with an String value.
Examble:
enum NumberFormat{hundredth = "##0.0#", thousandth= "##0.00#"}
how can i declare this??
Hi,
i won´t declare an enum NumberFormat{hundredth, thousandth} with an String value.
Examble:
enum NumberFormat{hundredth = "##0.0#", thousandth= "##0.00#"}
how can i declare this??
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
AlanRank #669 · 3.6K reputationPosted Apr 24, 2008, 5:44 AM EDT
You can't declare an enum with string values, only integer values are allowed.
Instead, I'd use a static class (.Net 2.0 or later):
public static class NumberFormat
{
public const string hundredth = "##0.0#";
public const string thousandth = "##0.00#";
}
string format = NumberFormat.hundredth;