|
이 문서는 기계로 번역한 것입니다. 원본 텍스트를 보려면 포인터를 문서의 문장 위로 올리십시오. 추가 정보
|
번역
원본
|
Convert.ToUInt16 메서드 (Single)
.NET Framework 4.5
이 API는 CLS 규격이 아닙니다. 네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)
매개 변수
- value
- 형식: System.Single
변환할 단정밀도 부동 소수점 숫자입니다.
반환 값
형식: System.UInt16| 예외 | 조건 |
|---|---|
| OverflowException |
float[] numbers = { Single.MinValue, -1.38e10f, -1023.299f, -12.98f, 0f, 9.113e-16f, 103.919f, 17834.191f, Single.MaxValue }; ushort result; foreach (float number in numbers) { try { result = Convert.ToUInt16(number); Console.WriteLine("Converted the {0} value '{1}' to the {2} value {3}.", number.GetType().Name, number, result.GetType().Name, result); } catch (OverflowException) { Console.WriteLine("{0} is outside the range of the UInt16 type.", number); } } // The example displays the following output: // -3.402823E+38 is outside the range of the UInt16 type. // -1.38E+10 is outside the range of the UInt16 type. // -1023.299 is outside the range of the UInt16 type. // -12.98 is outside the range of the UInt16 type. // Converted the Single value '0' to the UInt16 value 0. // Converted the Single value '9.113E-16' to the UInt16 value 0. // Converted the Single value '103.919' to the UInt16 value 104. // Converted the Single value '17834.19' to the UInt16 value 17834. // 3.402823E+38 is outside the range of the UInt16 type.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(서버 코어 역할은 지원되지 않음), Windows Server 2008 R2(서버 코어 역할은 SP1 이상에서 지원, Itanium은 지원되지 않음)
.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.