Re: decimal.MaxValue should be a constant
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 06/01/04
- Next message: art: "Access deployment with Visual Studio .Net 2003 Pro?"
- Previous message: Jon Skeet [C# MVP]: "Re: How to destroy arrays"
- In reply to: Günter Zöchbauer: "decimal.MaxValue should be a constant"
- Next in thread: Günter Zöchbauer: "Re: decimal.MaxValue should be a constant"
- Reply: Günter Zöchbauer: "Re: decimal.MaxValue should be a constant"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 1 Jun 2004 10:28:21 +0100
Günter Zöchbauer <zoechi@gmx.net> wrote:
> can anyone tell why
>
> [DefaultValue(int.MaxValue)] is valid
>
> but
>
> [DefaultValue(decimal.MaxValue)] produces compiler error:
>
> An attribute argument must be a constant expression, typeof expression or
> array creation expression
It looks like it's a bug in the way decimal.MaxValue is declared.
Rather than a compile-time constant, it's declared to just be static
readonly. I suspect this may make it easier to "get right" in the
class, but it's certainly a bit of a downside for anyone wanting to use
it in the way you do.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: art: "Access deployment with Visual Studio .Net 2003 Pro?"
- Previous message: Jon Skeet [C# MVP]: "Re: How to destroy arrays"
- In reply to: Günter Zöchbauer: "decimal.MaxValue should be a constant"
- Next in thread: Günter Zöchbauer: "Re: decimal.MaxValue should be a constant"
- Reply: Günter Zöchbauer: "Re: decimal.MaxValue should be a constant"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|