System.Runtime.CompilerServices.DecimalConstantAttribute Class

public sealed class DecimalConstantAttribute : Attribute

Base Types

Object
  Attribute
    DecimalConstantAttribute

Assembly

mscorlib

Library

RuntimeInfrastructure

Summary

Stores the value of a Decimal constant in metadata.

Description

[Note: This attribute can be applied to fields and parameters.

For more information on storing constants in metadata, see Partition II of the CLI Specification.

The types in System.Runtime.CompilerServices are intended primarily for use by compilers, not application programmers. They allow compilers to easily implement certain language features that are not directly visible to programmers.

]

Attributes

CLSCompliantAttribute(false), AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)

See Also

System.Runtime.CompilerServices Namespace

Members

DecimalConstantAttribute Constructors

DecimalConstantAttribute(byte, byte, uint, uint, uint) Constructor
DecimalConstantAttribute(System.String) Constructor


DecimalConstantAttribute(byte, byte, uint, uint, uint) Constructor

public DecimalConstantAttribute(byte scale, byte sign, uint hi, uint mid, uint low);

Summary

Constructs a new instance of the DecimalConstantAttribute class with the specified value.

Parameters

scale
A Byte that specifies the number of digits to the right of the decimal point in the value of the new instance. Valid scale values are 0 through 28 inclusive.
sign
A Byte that specifies the sign of the value of the new instance. Zero indicates a positive value; any non-zero value indicates a negative value.
hi
A UInt32 that specifies the high-order 32 bits of the value of the new instance.
mid
A UInt32 that specifies the middle 32 bits of the value of the new instance.
low
A UInt32 that specifies the low-order 32 bits of the value of the new instance.

Exceptions

Exception TypeCondition
ArgumentOutOfRangeExceptionscale > 28.

Description

[Note: For representations of Decimal whose values can have scales exceeding 255, the constructor System.Runtime.CompilerServices.DecimalConstantAttribute.System.DecimalConstantAttribute(System.String) must be used instead.]

See Also

System.Runtime.CompilerServices.DecimalConstantAttribute Class, System.Runtime.CompilerServices Namespace

DecimalConstantAttribute(System.String) Constructor

public DecimalConstantAttribute(string s)

Summary

Constructs a new instance of the DecimalConstantAttribute class with the specified value.

Parameters

s
A String containing the value to convert.

Exceptions

Exception TypeCondition
ArgumentNullExceptions is a null reference.
FormatExceptions is not in the correct format.
OverflowExceptions represents a number greater than System.Decimal.MaxValue or less than System.Decimal.MinValue.

Description

The format of s is specified by the grammar shown below, in which where the characters in the strings accepted for infinity and nan are not case-sensitive, trailing zero digits in decimal-part are significant, and he purpose of the sign of, and optional digits following, 'NaN' (quiet NaN) and 'sNaN' (signaling NaN) is unspecified. An implementation is free to ignore such signs and digits.

s shall not contain any white space characters.

If an implementation's representation of Decimal supports NaNs and infinities, that implementation shall correctly handle strings designating those values; otherwise, support for such strings is optional.

Results are rounded to the nearest representable value, and, when a result is equally close to two representable values, to the value that has an even number in the least significant digit position (banker's rounding).

numeric-string:: = [sign] numeric-value | [sign] nan
numeric-value:: = decimal-part [exponent-part] | infinity
decimal-part:: = digits '.' [digits] | ['.'] digits
exponent-part:: = indicator [sign] digits
sign:: = '+' | '-'
digits:: = digit [digit]+
digit:: = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
indicator:: = 'e' | 'E'
infinity:: = 'Infinity' | 'Inf'
nan:: = 'NaN' [digits] | 'sNaN' [digits]'

See Also

System.Runtime.CompilerServices.DecimalConstantAttribute Class, System.Runtime.CompilerServices Namespace