Thanks again.
I was not aware of the fact that the types allowed as attribute parameter
are limited.
ShouldSerializeXXX and ResetXXX are the solution in this case.
"Jon Skeet [C# MVP]" <sk***@pobox.com> schrieb im Newsbeitrag
news:MP************************@msnews.microsoft.c om...
Günter Zöchbauer <zo****@gmx.net> wrote:
Thanks for your help.
I tried a simple workaround but got the same error.
private const decimal maxValueDefault = 2^96;
[DefaultValue(maxValueDefault)]
Looks like the compiler can't handle decimal as constant.
Well, the first part compiles, so the compiler can certainly handle
decimal as a constant. What it can't do is apply it to attribute
parameters, as they can only be of types bool, byte, char, double,
float, int, long, short, or string. (C# type names copied from the spec
- hopefully it's obvious to any VB.NET readers what they correspond
to.)
So it looks like in this case it's the compiler error message which is
dodgy, not the compiler rules themselves.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too