Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Initialisiert eine neue Instanz von Decimal mit dem Wert einer angegebenen 64-Bit-Ganzzahl mit Vorzeichen.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Sub New ( _
value As Long _
)
'Usage
Dim value As Long
Dim instance As New Decimal(value)
public Decimal (
long value
)
public:
Decimal (
long long value
)
public Decimal (
long value
)
public function Decimal (
value : long
)
Parameter
- value
Der als Decimal darzustellende Wert.
Beispiel
Im folgenden Codebeispiel werden mehrere Decimal-Zahlen mithilfe der Konstruktorüberladung erstellt, die eine Decimal-Struktur mit einem Int64-Wert initialisiert.
' Example of the Decimal( Long ) constructor.
Imports System
Imports Microsoft.VisualBasic
Module DecimalCtorLDemo
' Create a Decimal object and display its value.
Sub CreateDecimal( value As Long, valToStr As String )
Dim decimalNum As New Decimal( value )
' Format the constructor for display.
Dim ctor As String = _
String.Format( "Decimal( {0} )", valToStr )
' Display the constructor and its value.
Console.WriteLine( "{0,-30}{1,22}", ctor, decimalNum )
End Sub
Sub Main( )
Console.WriteLine( _
"This example of the Decimal( Long ) constructor " & _
vbCrLf & "generates the following output." & vbCrLf )
Console.WriteLine( "{0,-30}{1,22}", "Constructor", "Value" )
Console.WriteLine( "{0,-30}{1,22}", "-----------", "-----" )
' Construct Decimal objects from Long values.
CreateDecimal( Long.MinValue, "Long.MinValue" )
CreateDecimal( Long.MaxValue, "Long.MaxValue" )
CreateDecimal( 0L, "0" )
CreateDecimal( 999999999999999999, "999999999999999999" )
CreateDecimal( &H2000000000000000, "&H2000000000000000" )
CreateDecimal( &HE000000000000000, "&HE000000000000000" )
End Sub
End Module
' This example of the Decimal( Long ) constructor
' generates the following output.
'
' Constructor Value
' ----------- -----
' Decimal( Long.MinValue ) -9223372036854775808
' Decimal( Long.MaxValue ) 9223372036854775807
' Decimal( 0 ) 0
' Decimal( 999999999999999999 ) 999999999999999999
' Decimal( &H2000000000000000 ) 2305843009213693952
' Decimal( &HE000000000000000 ) -2305843009213693952
// Example of the decimal( long ) constructor.
using System;
class DecimalCtorLDemo
{
// Create a decimal object and display its value.
public static void CreateDecimal( long value, string valToStr )
{
decimal decimalNum = new 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 );
}
public static void Main( )
{
Console.WriteLine( "This example of the decimal( long ) " +
"constructor \ngenerates the following output.\n" );
Console.WriteLine( "{0,-35}{1,22}", "Constructor", "Value" );
Console.WriteLine( "{0,-35}{1,22}", "-----------", "-----" );
// Construct decimal objects from long values.
CreateDecimal( long.MinValue, "long.MinValue" );
CreateDecimal( long.MaxValue, "long.MaxValue" );
CreateDecimal( 0L, "0L" );
CreateDecimal( 999999999999999999, "999999999999999999" );
CreateDecimal( 0x2000000000000000, "0x2000000000000000" );
CreateDecimal( unchecked( (long)0xE000000000000000 ),
"(long)0xE000000000000000" );
}
}
/*
This example of the decimal( long ) constructor
generates the following output.
Constructor Value
----------- -----
decimal( long.MinValue ) -9223372036854775808
decimal( long.MaxValue ) 9223372036854775807
decimal( 0 ) 0
decimal( 999999999999999999 ) 999999999999999999
decimal( 0x2000000000000000 ) 2305843009213693952
decimal( (long)0xE000000000000000 ) -2305843009213693952
*/
// 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
*/
// Example of the decimal( long ) constructor.
import System.* ;
class DecimalCtorLDemo
{
// Create a decimal object and display its value.
public static void CreateDecimal(long value, String valToStr)
{
System.Decimal decimalNum = new System.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);
} //CreateDecimal
public static void main(String[] args)
{
Console.WriteLine(("This example of the decimal( long ) "
+ "constructor \ngenerates the following output.\n"));
Console.WriteLine("{0,-35}{1,22}", "Constructor", "Value");
Console.WriteLine("{0,-35}{1,22}", "-----------", "-----");
// Construct decimal objects from long values.
CreateDecimal(Long.MIN_VALUE, "long.MinValue");
CreateDecimal(Long.MAX_VALUE, "long.MaxValue");
CreateDecimal(0L, "0");
CreateDecimal(999999999999999999L, "999999999999999999");
CreateDecimal(0x2000000000000000L, "0x2000000000000000");
CreateDecimal((long)(0xE000000000000000L), "(long)0xE000000000000000");
} //main
} //DecimalCtorLDemo
/*
This example of the decimal( long ) constructor
generates the following output.
Constructor Value
----------- -----
decimal( long.MinValue ) -9223372036854775808
decimal( long.MaxValue ) 9223372036854775807
decimal( 0 ) 0
decimal( 999999999999999999 ) 999999999999999999
decimal( 0x2000000000000000 ) 2305843009213693952
decimal( (long)0xE000000000000000 ) -2305843009213693952
*/
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0