1 // Compiler options: -r:test-319-lib.dll
4 using System
.Runtime
.CompilerServices
;
6 public class ConstFields
8 public const decimal ConstDecimal1
= 314159265358979323846m
;
9 public static readonly decimal ConstDecimal2
= -314159265358979323846m
;
10 public const decimal ConstDecimal3
= -3;
11 public const decimal ConstDecimal4
= 0;
12 public const decimal MaxValue
= 79228162514264337593543950335m
;
13 public const decimal MaxLongValue
= long.MaxValue
;
15 // TODO: check this value
16 static readonly Decimal MaxValueDiv10
= MaxValue
/ 10;
18 static decimal DecimalValue
= -90;
19 const decimal SmallConstValue
= .02M
;
21 public static int Main ()
23 Type t
= typeof (ConstFields
);
24 DecimalConstantAttribute a
= (DecimalConstantAttribute
) t
.GetField ("ConstDecimal3").GetCustomAttributes (typeof (DecimalConstantAttribute
), false)[0];
25 if (a
.Value
!= ConstDecimal3
)
28 a
= (DecimalConstantAttribute
) t
.GetField ("ConstDecimal1").GetCustomAttributes (typeof (DecimalConstantAttribute
), false)[0];
29 if (a
.Value
!= 314159265358979323846m
)
32 if (ConstDecimal1
!= (-1) * ConstDecimal2
)
35 if (!(SmallConstValue
< 1 && SmallConstValue
> 0))
38 decimal ld
= long.MaxValue
;
39 Console
.WriteLine (ld
);
42 Console
.WriteLine (C
.D
);
43 Console
.WriteLine (Decimal
.One
);
44 Console
.WriteLine (DecimalValue
);
45 Console
.WriteLine (Decimal
.MaxValue
);
47 Console
.WriteLine ("Success");