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

Int16.MaxValue 필드

Int16 의 최대값을 나타냅니다. 이 필드는 상수입니다.

네임스페이스:  System
어셈블리:  mscorlib(mscorlib.dll)
public const short MaxValue

이 상수의 값은 32767(16진수 0x7FFF)입니다.

일반적으로 MaxValue 속성은 상한이 더 높은 UInt16 또는 Int32 등의 숫자 형식을 Int16으로 변환할 때 OverflowException을 방지하는 데 사용됩니다. 예제에서는 이러한 사용 방법을 보여 줍니다.

다음 예제에서는 MaxValue 속성을 사용하여 Int16 값을 변환할 때 OverflowException을 방지합니다.


long[] numbersToConvert = {162345, 32183, -54000};
short newNumber;
foreach (long number in numbersToConvert)
{
   if (number >= Int16.MinValue && number <= Int16.MaxValue)
   {
      newNumber = Convert.ToInt16(number);
      Console.WriteLine("Successfully converted {0} to an Int16.", 
                        newNumber);
   }
   else
   {
      Console.WriteLine("Unable to convert {0} to an Int16.", number);
   }
}
// The example displays the following output to the console:
//       Unable to convert 162345 to an Int16.
//       Successfully converted 32183 to an Int16.
//       Unable to convert -54000 to an Int16.   


.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자 남음)

커뮤니티 추가 항목

추가
© 2013 Microsoft. All rights reserved.