이 문서는 기계로 번역한 것입니다. 원본 텍스트를 보려면 포인터를 문서의 문장 위로 올리십시오. 추가 정보
번역
원본
이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

Convert.ToInt64 메서드 (Decimal)

지정된 10진수 값을 해당하는 64비트 부호 있는 정수로 변환합니다.

네임스페이스:  System
어셈블리:  mscorlib(mscorlib.dll)
public static long ToInt64(
	decimal value
)

매개 변수

value
형식: System.Decimal
변환할 10진수입니다.

반환 값

형식: System.Int64
가장 가까운 64비트 부호 있는 정수로 반올림된 value를 반환합니다. value가 두 정수 사이의 값이면 짝수 값을 반환합니다. 예를 들어, 4.5는 4로 변환되고 5.5는 6으로 변환됩니다.
예외조건
OverflowException

valueInt64.MaxValue보다 크거나 Int64.MinValue보다 작은 경우

다음 예제에서는 Decimal 값의 배열에서 각 요소를 정수(long)로 변환합니다.


decimal[] values= { Decimal.MinValue, -1034.23m, -12m, 0m, 147m,
                    199.55m, 9214.16m, Decimal.MaxValue };
long result;

foreach (decimal value in values)
{
   try {
      result = Convert.ToInt64(value);
      Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.",
                        value.GetType().Name, value,
                        result.GetType().Name, result);
   }
   catch (OverflowException) {
      Console.WriteLine("{0} is outside the range of the Int64 type.",
                        value);
   }   
}                                  
// The example displays the following output:
//    -79228162514264337593543950335 is outside the range of the Int64 type.
//    Converted the Decimal value '-1034.23' to the Int64 value -1034.
//    Converted the Decimal value '-12' to the Int64 value -12.
//    Converted the Decimal value '0' to the Int64 value 0.
//    Converted the Decimal value '147' to the Int64 value 147.
//    Converted the Decimal value '199.55' to the Int64 value 200.
//    Converted the Decimal value '9214.16' to the Int64 value 9214.
//    79228162514264337593543950335 is outside the range of the Int64 type.


.NET Framework

4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0에서 지원

.NET Framework Client Profile

4, 3.5 SP1에서 지원

이식 가능한 클래스 라이브러리

이식 가능한 클래스 라이브러리에서 지원

Windows 스토어 앱용 .NET

Windows 8에서 지원

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(서버 코어 역할은 지원되지 않음), Windows Server 2008 R2(서버 코어 역할은 SP1 이상에서 지원, Itanium은 지원되지 않음)

.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
이 정보가 도움이 되었습니까?
(1500자 남음)

커뮤니티 추가 항목

추가
Microsoft는 MSDN 웹 사이트에 대한 귀하의 의견을 이해하기 위해 온라인 설문 조사를 진행하고 있습니다. 참여하도록 선택하시면 MSDN 웹 사이트에서 나가실 때 온라인 설문 조사가 표시됩니다.

참여하시겠습니까?
© 2013 Microsoft. All rights reserved.