Hi guys
I'm using C# to set a default value for a decimal value in my config class
public class ConfigSection : ConfigurationSection
{
[ConfigurationProperty("paymentInAdvanceAmount", **DefaultValue = 440m**)]
public decimal PaymentInAdvanceAmount
{
get { return (decimal)base["paymentInAdvanceAmount"]; }
set { base["paymentInAdvanceAmount"] = value; }
}
}
but it won't be compiled and throws an error
An attribute argument must be a constant expression, typeof expression
I found a post says: "It's not a bug. "1000M" is merely shorthand for "new Decimal(1000)", which involves a method call, which means it's not considered a constant. Just because the compile lets you pretend it's a constant most of the time, doesn't mean you can all of the time."
Now, how do I workaround it?