This documentation is archived and is not being maintained.
Decimal Constructor (Int64)
Visual Studio 2010
Initializes a new instance of Decimal to the value of the specified 64-bit signed integer.
Assembly: mscorlib (in mscorlib.dll)
The following code example creates several Decimal numbers using the constructor overload that initializes a Decimal structure with an Int64 value.
// Example of the Decimal( __int64 ) constructor. using namespace System; // Create a Decimal object and display its value. void CreateDecimal( __int64 value, String^ valToStr ) { Decimal decimalNum = Decimal(value); // Format the constructor for display. String^ ctor = String::Format( "Decimal( {0} )", valToStr ); // Display the constructor and its value. Console::WriteLine( "{0,-35}{1,22}", ctor, decimalNum ); } int main() { Console::WriteLine( "This example of the Decimal( __int64 ) " "constructor \ngenerates the following output.\n" ); Console::WriteLine( "{0,-35}{1,22}", "Constructor", "Value" ); Console::WriteLine( "{0,-35}{1,22}", "-----------", "-----" ); // Construct Decimal objects from __int64 values. CreateDecimal( Int64::MinValue, "Int64::MinValue" ); CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); CreateDecimal( 0, "0" ); CreateDecimal( 999999999999999999, "999999999999999999" ); CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); } /* This example of the Decimal( __int64 ) constructor generates the following output. Constructor Value ----------- ----- Decimal( Int64::MinValue ) -9223372036854775808 Decimal( Int64::MaxValue ) 9223372036854775807 Decimal( 0 ) 0 Decimal( 999999999999999999 ) 999999999999999999 Decimal( 0x2000000000000000 ) 2305843009213693952 Decimal( 0xE000000000000000 ) -2305843009213693952 */
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: