diff options
Diffstat (limited to 'src/mscorlib/shared/System/Runtime/CompilerServices/DecimalConstantAttribute.cs')
-rw-r--r-- | src/mscorlib/shared/System/Runtime/CompilerServices/DecimalConstantAttribute.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DecimalConstantAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DecimalConstantAttribute.cs new file mode 100644 index 0000000000..19db84eb43 --- /dev/null +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DecimalConstantAttribute.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Note: If you add a new ctor overloads you need to update ParameterInfo.RawDefaultValue + +namespace System.Runtime.CompilerServices +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] + public sealed class DecimalConstantAttribute : Attribute + { + private Decimal _dec; + + [CLSCompliant(false)] + public DecimalConstantAttribute( + byte scale, + byte sign, + uint hi, + uint mid, + uint low + ) + { + _dec = new Decimal((int)low, (int)mid, (int)hi, (sign != 0), scale); + } + + public DecimalConstantAttribute( + byte scale, + byte sign, + int hi, + int mid, + int low + ) + { + _dec = new Decimal(low, mid, hi, (sign != 0), scale); + } + + public Decimal Value => _dec; + } +} |