Decimal.FromOACurrency 메서드
OLE Automation Currency 값을 포함하는 지정된 64비트의 부호 있는 정수를 동일한 Decimal 값으로 변환합니다.
네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
Public Shared Function FromOACurrency ( _
cy As Long _
) As Decimal
‘사용 방법
Dim cy As Long
Dim returnValue As Decimal
returnValue = Decimal.FromOACurrency(cy)
public static decimal FromOACurrency (
long cy
)
public:
static Decimal FromOACurrency (
long long cy
)
public static Decimal FromOACurrency (
long cy
)
public static function FromOACurrency (
cy : long
) : decimal
매개 변수
- cy
OLE Automation Currency 값입니다.
반환 값
cy와 같은 값을 가지는 Decimal입니다.
예제
다음 코드 예제에서는 FromOACurrency 메서드를 사용하여 OLE Automation Currency 값을 포함하는 Int64 필드를 동일한 Decimal 숫자로 변환합니다.
' Example of the Decimal.FromOACurrency method.
Imports System
Imports Microsoft.VisualBasic
Module DecimalFromOACurrencyDemo
Const dataFmt As String = "{0,21}{1,25}"
' Display the Decimal.FromOACurrency parameter and Decimal result.
Sub ShowDecimalFromOACurrency( Argument As Long )
Dim decCurrency As Decimal = _
Decimal.FromOACurrency( Argument )
Console.WriteLine( dataFmt, Argument, decCurrency )
End Sub
Sub Main( )
Console.WriteLine( "This example of the " & _
"Decimal.FromOACurrency( ) method generates " & vbCrLf & _
"the following output. It displays the OLE Automation " & _
"Currency " & vbCrLf & "value as a Long and the " & _
"result as a Decimal." & vbCrLf )
Console.WriteLine( dataFmt, "OA Currency", "Decimal Value" )
Console.WriteLine( dataFmt, "-----------", "-------------" )
' Convert OLE Automation Currency values to Decimal objects.
ShowDecimalFromOACurrency( 0L )
ShowDecimalFromOACurrency( 1L )
ShowDecimalFromOACurrency( 100000L )
ShowDecimalFromOACurrency( 100000000000L )
ShowDecimalFromOACurrency( 1000000000000000000L )
ShowDecimalFromOACurrency( 1000000000000000001L )
ShowDecimalFromOACurrency( Long.MaxValue )
ShowDecimalFromOACurrency( Long.MinValue )
ShowDecimalFromOACurrency( 123456789L )
ShowDecimalFromOACurrency( 1234567890000L )
ShowDecimalFromOACurrency( 1234567890987654321 )
ShowDecimalFromOACurrency( 4294967295L )
End Sub
End Module
' This example of the Decimal.FromOACurrency( ) method generates
' the following output. It displays the OLE Automation Currency
' value as a Long and the result as a Decimal.
'
' OA Currency Decimal Value
' ----------- -------------
' 0 0
' 1 0.0001
' 100000 10
' 100000000000 10000000
' 1000000000000000000 100000000000000
' 1000000000000000001 100000000000000.0001
' 9223372036854775807 922337203685477.5807
' -9223372036854775808 -922337203685477.5808
' 123456789 12345.6789
' 1234567890000 123456789
' 1234567890987654321 123456789098765.4321
' 4294967295 429496.7295
// Example of the decimal.FromOACurrency method.
using System;
class DecimalFromOACurrencyDemo
{
const string dataFmt = "{0,21}{1,25}";
// Display the decimal.FromOACurrency parameter and decimal result.
public static void ShowDecimalFromOACurrency( long Argument )
{
decimal decCurrency = decimal.FromOACurrency( Argument );
Console.WriteLine( dataFmt, Argument, decCurrency );
}
public static void Main( )
{
Console.WriteLine( "This example of the " +
"decimal.FromOACurrency( ) method generates \nthe " +
"following output. It displays the OLE Automation " +
"Currency \nvalue as a long and the result as a " +
"decimal.\n" );
Console.WriteLine( dataFmt, "OA Currency", "Decimal Value" );
Console.WriteLine( dataFmt, "-----------", "-------------" );
// Convert OLE Automation Currency values to decimal objects.
ShowDecimalFromOACurrency( 0L );
ShowDecimalFromOACurrency( 1L );
ShowDecimalFromOACurrency( 100000L );
ShowDecimalFromOACurrency( 100000000000L );
ShowDecimalFromOACurrency( 1000000000000000000L );
ShowDecimalFromOACurrency( 1000000000000000001L );
ShowDecimalFromOACurrency( long.MaxValue );
ShowDecimalFromOACurrency( long.MinValue );
ShowDecimalFromOACurrency( 123456789L );
ShowDecimalFromOACurrency( 1234567890000L );
ShowDecimalFromOACurrency( 1234567890987654321 );
ShowDecimalFromOACurrency( 4294967295L );
}
}
/*
This example of the decimal.FromOACurrency( ) method generates
the following output. It displays the OLE Automation Currency
value as a long and the result as a decimal.
OA Currency Decimal Value
----------- -------------
0 0
1 0.0001
100000 10
100000000000 10000000
1000000000000000000 100000000000000
1000000000000000001 100000000000000.0001
9223372036854775807 922337203685477.5807
-9223372036854775808 -922337203685477.5808
123456789 12345.6789
1234567890000 123456789
1234567890987654321 123456789098765.4321
4294967295 429496.7295
*/
// Example of the Decimal::FromOACurrency method.
using namespace System;
#define dataFmt "{0,21}{1,25}"
// Display the Decimal::FromOACurrency parameter and Decimal result.
void ShowDecimalFromOACurrency( __int64 Argument )
{
Decimal decCurrency = Decimal::FromOACurrency( Argument );
Console::WriteLine( dataFmt, Argument, decCurrency );
}
int main()
{
Console::WriteLine( "This example of the "
"Decimal::FromOACurrency( ) method generates \nthe "
"following output. It displays the OLE Automation "
"Currency \nvalue as an __int64 and the result as a "
"Decimal.\n" );
Console::WriteLine( dataFmt, "OA Currency", "Decimal Value" );
Console::WriteLine( dataFmt, "-----------", "-------------" );
// Convert OLE Automation Currency values to Decimal objects.
ShowDecimalFromOACurrency( 0L );
ShowDecimalFromOACurrency( 1L );
ShowDecimalFromOACurrency( 100000L );
ShowDecimalFromOACurrency( 100000000000L );
ShowDecimalFromOACurrency( 1000000000000000000L );
ShowDecimalFromOACurrency( 1000000000000000001L );
ShowDecimalFromOACurrency( Int64::MaxValue );
ShowDecimalFromOACurrency( Int64::MinValue );
ShowDecimalFromOACurrency( 123456789L );
ShowDecimalFromOACurrency( 1234567890000L );
ShowDecimalFromOACurrency( 1234567890987654321 );
ShowDecimalFromOACurrency( 4294967295L );
}
/*
This example of the Decimal::FromOACurrency( ) method generates
the following output. It displays the OLE Automation Currency
value as an __int64 and the result as a Decimal.
OA Currency Decimal Value
----------- -------------
0 0
1 0.0001
100000 10
100000000000 10000000
1000000000000000000 100000000000000
1000000000000000001 100000000000000.0001
9223372036854775807 922337203685477.5807
-9223372036854775808 -922337203685477.5808
123456789 12345.6789
1234567890000 123456789
1234567890987654321 123456789098765.4321
4294967295 429496.7295
*/
// Example of the decimal.FromOACurrency method.
import System.*;
class DecimalFromOACurrencyDemo
{
private static String dataFmt = "{0,21}{1,25}";
// Display the decimal.FromOACurrency parameter and decimal result.
public static void ShowDecimalFromOACurrency(long Argument)
{
System.Decimal decCurrency = System.Decimal.FromOACurrency(Argument);
Console.WriteLine(dataFmt,System.Convert.ToString(Argument),
decCurrency);
} //ShowDecimalFromOACurrency
public static void main(String[] args)
{
Console.WriteLine( "This example of the "
+ "decimal.FromOACurrency( ) method generates \nthe "
+ "following output. It displays the OLE Automation "
+ "Currency \nvalue as a long and the result as a "
+ "decimal.\n" );
Console.WriteLine( dataFmt, "OA Currency", "Decimal Value" );
Console.WriteLine( dataFmt, "-----------", "-------------" );
//Convert OLE Automation Currency values to decimal objects.
ShowDecimalFromOACurrency( 0L );
ShowDecimalFromOACurrency( 1L );
ShowDecimalFromOACurrency( 100000L );
ShowDecimalFromOACurrency( 100000000000L );
ShowDecimalFromOACurrency( 1000000000000000000L );
ShowDecimalFromOACurrency( 1000000000000000001L );
ShowDecimalFromOACurrency( Long.MAX_VALUE );
ShowDecimalFromOACurrency( Long.MIN_VALUE );
ShowDecimalFromOACurrency( 123456789L );
ShowDecimalFromOACurrency( 1234567890000L );
ShowDecimalFromOACurrency( 1234567890987654321L );
ShowDecimalFromOACurrency( 4294967295L );
} //main
} //DecimalFromOACurrencyDemo
/*
This example of the decimal.FromOACurrency( ) method generates
the following output. It displays the OLE Automation Currency
value as a long and the result as a decimal.
OA Currency Decimal Value
----------- -------------
0 0
1 0.0001
100000 10
100000000000 10000000
1000000000000000000 100000000000000
1000000000000000001 100000000000000.0001
9223372036854775807 922337203685477.5807
-9223372036854775808 -922337203685477.5808
123456789 12345.6789
1234567890000 123456789
1234567890987654321 123456789098765.4321
4294967295 429496.7295
*/
플랫폼
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원