類型轉換函式 (Visual Basic)Type Conversion Functions (Visual Basic)

這些函式是編譯的內嵌,這表示,轉換程式碼評估運算式的程式碼的一部分。These functions are compiled inline, meaning the conversion code is part of the code that evaluates the expression. 有時是沒有呼叫程序來完成轉換,進而改善效能。Sometimes there is no call to a procedure to accomplish the conversion, which improves performance. 每個函式強制轉型為特定的資料類型的運算式。Each function coerces an expression to a specific data type.

語法Syntax

CBool(expression)  
CByte(expression)  
CChar(expression)  
CDate(expression)  
CDbl(expression)  
CDec(expression)  
CInt(expression)  
CLng(expression)  
CObj(expression)  
CSByte(expression)  
CShort(expression)  
CSng(expression)  
CStr(expression)  
CUInt(expression)  
CULng(expression)  
CUShort(expression)  

組件Part

expression
必要項。Required. 來源資料型別的任何運算式。Any expression of the source data type.

傳回值的資料類型Return Value Data Type

下表所示,函式名稱會決定它所傳回的值的資料類型。The function name determines the data type of the value it returns, as shown in the following table.

函式名稱Function name 傳回資料類型Return data type 範圍expression引數Range for expression argument
CBool Boolean 資料類型Boolean Data Type 任何有效CharString或數值運算式。Any valid Char or String or numeric expression.
CByte Byte 資料類型Byte Data Type Byte.MinValue (0) 透過Byte.MaxValue(255) (不帶正負號),會捨去小數部分。1Byte.MinValue (0) through Byte.MaxValue (255) (unsigned); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 最佳化的效能與位元組轉換成浮點數CByte函式; 請參閱備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to byte conversion with the CByte function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CChar Char 資料類型Char Data Type 任何有效Char或是String運算式; 只有第一個字元String轉換; 值可以是 0 到 65535 (不帶正負號)。Any valid Char or String expression; only first character of a String is converted; value can be 0 through 65535 (unsigned).
CDate Date 資料類型Date Data Type 日期和時間的任何有效表示法。Any valid representation of a date and time.
CDbl Double 資料類型Double Data Type -1.79769313486231570 e + 308 到-4.94065645841246544-324 (負值)4.94065645841246544-324 到 1.79769313486231570 e + 308 的正值。-1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values; 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values.
CDec Decimal 資料類型Decimal Data Type + /-零擴充的數字,也就是任何小數位數的數字 79228162514264337593543950335。+/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. 如 28 位小數的數字,範圍是 + /--7.9228162514264337593543950335。For numbers with 28 decimal places, the range is +/-7.9228162514264337593543950335. 最小可能的非零值是 0.0000000000000000000000000001 (+ /-1E-28)。The smallest possible non-zero number is 0.0000000000000000000000000001 (+/-1E-28).
CInt Integer 資料類型Integer Data Type Int32.MinValue (-2,147,483,648) 到Int32.MaxValue(2147483647),會捨去小數部分。1Int32.MinValue (-2,147,483,648) through Int32.MaxValue (2,147,483,647); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 最佳化與整數轉換成浮點數的效能CInt函式; 請參閱 < 備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to integer conversion with the CInt function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CLng Long 資料類型Long Data Type Int64.MinValue (-9223372036854775808) 到Int64.MaxValue(9223372036854775807),會捨去小數部分。1Int64.MinValue (-9,223,372,036,854,775,808) through Int64.MaxValue (9,223,372,036,854,775,807); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 將效能最佳化浮點,以使用 64 位元的整數轉換CLng函式; 請參閱 < 備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to 64-bit integer conversion with the CLng function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CObj Object 資料類型Object Data Type 任何有效的運算式。Any valid expression.
CSByte SByte 資料類型SByte Data Type SByte.MinValue (-128) 透過SByte.MaxValue(127),會捨去小數部分。1SByte.MinValue (-128) through SByte.MaxValue (127); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 最佳化的效能與帶正負號的位元組轉換成浮點數CSByte函式; 請參閱 < 備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to signed byte conversion with the CSByte function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CShort Short 資料類型Short Data Type Int16.MinValue (-32,768) 到Int16.MaxValue(32,767),會捨去小數部分。1Int16.MinValue (-32,768) through Int16.MaxValue (32,767); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 最佳化的效能與 16 位元的整數轉換成浮點數CShort函式; 請參閱備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to 16-bit integer conversion with the CShort function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CSng Single 資料類型Single Data Type -3.402823 e + 38 到-1.401298E-45 (負值)從 1.401298E-45 到 3.402823 e + 38 的正數值。-3.402823E+38 through -1.401298E-45 for negative values; 1.401298E-45 through 3.402823E+38 for positive values.
CStr String 資料類型String Data Type 會傳回CStr取決於expression引數。Returns for CStr depend on the expression argument. 請參閱CStr 函式的傳回值See Return Values for the CStr Function.
CUInt UInteger 資料類型UInteger Data Type UInt32.MinValue (0) 透過UInt32.MaxValue(4,294,967,295) (不帶正負號),會捨去小數部分。1UInt32.MinValue (0) through UInt32.MaxValue (4,294,967,295) (unsigned); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 將效能最佳化的與不帶正負號的整數轉換成浮點數CUInt函式; 請參閱 < 備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to unsigned integer conversion with the CUInt function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CULng ULong 資料類型ULong Data Type UInt64.MinValue (0) 透過UInt64.MaxValue(18446744073709551615) (不帶正負號),會捨去小數部分。1UInt64.MinValue (0) through UInt64.MaxValue (18,446,744,073,709,551,615) (unsigned); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 將效能最佳化的與不帶正負號的長整數轉換成浮點數CULng函式; 請參閱 < 備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to unsigned long integer conversion with the CULng function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.
CUShort UShort 資料類型UShort Data Type UInt16.MinValue (0) 透過UInt16.MaxValue(65,535) (不帶正負號),會捨去小數部分。1UInt16.MinValue (0) through UInt16.MaxValue (65,535) (unsigned); fractional parts are rounded.1

從 Visual Basic 15.8 開始,Visual Basic 將效能最佳化的與不帶正負號的 16 位元整數轉換成浮點數CUShort函式; 請參閱備註節的詳細資訊。Starting with Visual Basic 15.8, Visual Basic optimizes the performance of floating-point to unsigned 16-bit integer conversion with the CUShort function; see the Remarks section for more information. 請參閱CInt 範例一節中的範例。See the CInt Example section for an example.

1小數部分可能會受到特殊類型的捨入呼叫影響銀行進位1 Fractional parts can be subject to a special type of rounding called banker's rounding. 如需詳細資訊,請參閱 < 備註 >。See "Remarks" for more information.

備註Remarks

因此,您應該使用 Visual Basic 型別轉換函式,而非.NET Framework 方法,例如ToString(),在Convert類別或個別類型結構或類別。As a rule, you should use the Visual Basic type conversion functions in preference to the .NET Framework methods such as ToString(), either on the Convert class or on an individual type structure or class. Visual Basic 函式專為 Visual Basic 程式碼,最佳的互動,它們也可讓您的程式碼更簡短、 更方便閱讀。The Visual Basic functions are designed for optimal interaction with Visual Basic code, and they also make your source code shorter and easier to read. 此外,.NET Framework 轉換方法不一定會產生與 Visual Basic 函式,例如,轉換時相同的結果BooleanIntegerIn addition, the .NET Framework conversion methods do not always produce the same results as the Visual Basic functions, for example when converting Boolean to Integer. 如需詳細資訊,請參閱 < 疑難排解資料型別For more information, see Troubleshooting Data Types.

從 Visual Basic 15.8,浮點-點對點-整數的轉換的效能最佳化傳遞時Single或是Double遵循以下方法傳回整數的轉換函式的其中一個值 (CByteCShort, CInt, CLng, CSByte, CUShort, CUInt, CULng):Starting with Visual Basic 15.8, the performance of floating-point-to-integer conversion is optimized when you pass the Single or Double value returned by the following methods to one of the integer conversion functions (CByte, CShort, CInt, CLng, CSByte, CUShort, CUInt, CULng):

此最佳化可讓執行整數轉換為以兩倍速度執行的一大堆程式碼。This optimization allows code that does a large number of integer conversions to run up to twice as fast. 下列範例會說明這些最佳化浮點-點對點對整數的轉換:The following example illustrates these optimized floating-point-to-integer conversions:

Dim s As Single = 173.7619
Dim d As Double = s 

Dim i1 As Integer = CInt(Fix(s))               ' Result: 173
Dim b1 As Byte = CByte(Int(d))                 ' Result: 173
Dim s1 AS Short = CShort(Math.Truncate(s))     ' Result: 173
Dim i2 As Integer = CInt(Math.Ceiling(d))      ' Result: 174
Dim i3 As Integer = CInt(Math.Round(s))        ' Result: 174

行為Behavior

  • 強制型轉。Coercion. 一般情況下,您可以使用資料類型轉換函式,以強制轉型作業特定的資料類型,而不是預設的資料類型的結果。In general, you can use the data type conversion functions to coerce the result of an operation to a particular data type rather than the default data type. 例如,使用CDec來強制執行在其中單精確度、 雙精確度或整數算術會通常會發生的情況下的十進位運算。For example, use CDec to force decimal arithmetic in cases where single-precision, double-precision, or integer arithmetic would normally take place.

  • 轉換失敗。Failed Conversions. 如果expression傳遞至函式超出範圍的資料型別,它就是轉換, OverflowException ,就會發生。If the expression passed to the function is outside the range of the data type to which it is to be converted, an OverflowException occurs.

  • 小數部分。Fractional Parts. 當您將非整數值轉換成整數類型,整數的轉換函式 (CByteCIntCLngCSByteCShortCUIntCULng,以及CUShort) 移除小數部分,並捨入為最接近的整數值。When you convert a nonintegral value to an integral type, the integer conversion functions (CByte, CInt, CLng, CSByte, CShort, CUInt, CULng, and CUShort) remove the fractional part and round the value to the closest integer.

    如果小數部分正好 0.5,整數的轉換函式將它四捨五入到最接近的偶數整數。If the fractional part is exactly 0.5, the integer conversion functions round it to the nearest even integer. 比方說,0.5 捨入為 0,1.5 和 2.5 都會捨入為 2。For example, 0.5 rounds to 0, and 1.5 and 2.5 both round to 2. 這有時候稱為銀行進位,其用途是為了彌補可能會不斷累積時將許多這類的數字相加的偏差。This is sometimes called banker's rounding, and its purpose is to compensate for a bias that could accumulate when adding many such numbers together.

    CIntCLng有所不同IntFix函式,其截斷,而不是四捨五入,數字的小數部分。CInt and CLng differ from the Int and Fix functions, which truncate, rather than round, the fractional part of a number. 此外,FixInt一律傳回相同的資料類型的值,因為您傳入。Also, Fix and Int always return a value of the same data type as you pass in.

  • 日期/時間轉換。Date/Time Conversions. 使用IsDate函式來判斷值是否可轉換成日期和時間。Use the IsDate function to determine if a value can be converted to a date and time. CDate 可辨識的日期常值和時間常值,但不是數值。CDate recognizes date literals and time literals but not numeric values. 若要轉換 Visual Basic 6.0Date值加入DateVisual Basic 2005 中的值或更新版本,您可以使用DateTime.FromOADate方法。To convert a Visual Basic 6.0 Date value to a Date value in Visual Basic 2005 or later versions, you can use the DateTime.FromOADate method.

  • 中性日期/時間值。Neutral Date/Time Values. 日期資料型別一定會包含日期和時間資訊。The Date Data Type always contains both date and time information. 基於型別轉換的詳細資訊,Visual Basic,請考慮為的 1/1/0001 (1 年的 1 年)中性值是中性的值時間的日期和 00:00:00 (午夜)。For purposes of type conversion, Visual Basic considers 1/1/0001 (January 1 of the year 1) to be a neutral value for the date, and 00:00:00 (midnight) to be a neutral value for the time. 如果您將轉換Date值為字串,CStr不產生的字串中包含中性的值。If you convert a Date value to a string, CStr does not include neutral values in the resulting string. 例如,如果您將轉換#January 1, 0001 9:30:00#為字串,結果會是 「 上午 9:30:00",隱藏的日期資訊。For example, if you convert #January 1, 0001 9:30:00# to a string, the result is "9:30:00 AM"; the date information is suppressed. 不過,日期資訊是仍會出現在原始Date值,而且可以使用函式這類復原DatePart函式。However, the date information is still present in the original Date value and can be recovered with functions such as DatePart function.

  • 區分文化。Culture Sensitivity. 字串類型轉換函式會執行目前的文化特性設定,應用程式為基礎的轉換。The type conversion functions involving strings perform conversions based on the current culture settings for the application. 比方說,CDate會辨識您的系統地區設定的日期格式。For example, CDate recognizes date formats according to the locale setting of your system. 您必須提供一天、 月和年在您的地區設定,以正確的順序,或可能不正確地解譯日期。You must provide the day, month, and year in the correct order for your locale, or the date might not be interpreted correctly. 如果它包含的週日期字串,例如"Wednesday"無法辨識的長日期格式。A long date format is not recognized if it contains a day-of-the-week string, such as "Wednesday".

    如果您需要將轉換成或從您的地區設定所指定以外格式的值的字串表示,您無法使用 Visual Basic 型別轉換函式。If you need to convert to or from a string representation of a value in a format other than the one specified by your locale, you cannot use the Visual Basic type conversion functions. 若要這樣做,請使用ToString(IFormatProvider)Parse(String, IFormatProvider)該實值型別的方法。To do this, use the ToString(IFormatProvider) and Parse(String, IFormatProvider) methods of that value's type. 比方說,使用Double.Parse若要將字串轉換成Double,並使用Double.ToString轉換類型的值時Double為字串。For example, use Double.Parse when converting a string to a Double, and use Double.ToString when converting a value of type Double to a string.

CType FunctionCType Function

CType 函式採用第二個引數typename,會強制轉型expressiontypename,其中typename可以是任何資料類型、 結構、 類別或介面要有有效的轉換。The CType Function takes a second argument, typename, and coerces expression to typename, where typename can be any data type, structure, class, or interface to which there exists a valid conversion.

如需的比較CType類型轉換關鍵字,請參閱DirectCast 運算子TryCast 運算子For a comparison of CType with the other type conversion keywords, see DirectCast Operator and TryCast Operator.

CBool 範例CBool Example

下列範例會使用CBool函式將轉換運算式到Boolean值。The following example uses the CBool function to convert expressions to Boolean values. 如果運算式評估為非零值,CBool會傳回True; 否則它會傳回FalseIf an expression evaluates to a nonzero value, CBool returns True; otherwise, it returns False.

Dim a, b, c As Integer
Dim check As Boolean
a = 5
b = 5
' The following line of code sets check to True.
check = CBool(a = b)
c = 0
' The following line of code sets check to False.
check = CBool(c)

CByte 範例CByte Example

下列範例會使用CByte函式將轉換運算式,以ByteThe following example uses the CByte function to convert an expression to a Byte.

Dim aDouble As Double
Dim aByte As Byte
aDouble = 125.5678
' The following line of code sets aByte to 126.
aByte = CByte(aDouble)

CChar 範例CChar Example

下列範例會使用CChar要轉換的第一個字元的函式String運算式Char型別。The following example uses the CChar function to convert the first character of a String expression to a Char type.

Dim aString As String
Dim aChar As Char
' CChar converts only the first character of the string.
aString = "BCD"
' The following line of code sets aChar to "B".
aChar = CChar(aString)

若要輸入的引數CChar必須是資料型別CharStringThe input argument to CChar must be of data type Char or String. 您無法使用CChar轉換成字元,數字,因為CChar無法接受的數值資料類型。You cannot use CChar to convert a number to a character, because CChar cannot accept a numeric data type. 下列範例會取得代表的字碼指標 (字元碼) 的數字,並將它轉換成對應的字元。The following example obtains a number representing a code point (character code) and converts it to the corresponding character. 它會使用InputBox函式來取得的數字、 字串CInt若要將字串轉換為類型Integer,和ChrW轉換要輸入的數字CharIt uses the InputBox function to obtain the string of digits, CInt to convert the string to type Integer, and ChrW to convert the number to type Char.

Dim someDigits As String
Dim codePoint As Integer
Dim thisChar As Char
someDigits = InputBox("Enter code point of character:")
codePoint = CInt(someDigits)
' The following line of code sets thisChar to the Char value of codePoint.
thisChar = ChrW(codePoint)

CDate 範例CDate Example

下列範例會使用CDate函式來將字串轉換為Date值。The following example uses the CDate function to convert strings to Date values. 一般情況下,不建議硬式編碼的日期和時間字串 (如本範例所示)。In general, hard-coding dates and times as strings (as shown in this example) is not recommended. 使用日期常值和時間常值,例如 #Feb 12,1969 # 和 # 4:45:23 PM #,改為。Use date literals and time literals, such as #Feb 12, 1969# and #4:45:23 PM#, instead.

Dim aDateString, aTimeString As String
Dim aDate, aTime As Date
aDateString = "February 12, 1969"
aTimeString = "4:35:47 PM"
' The following line of code sets aDate to a Date value.
aDate = CDate(aDateString)
' The following line of code sets aTime to Date value.
aTime = CDate(aTimeString)

CDbl 範例CDbl Example

Dim aDec As Decimal
Dim aDbl As Double
' The following line of code uses the literal type character D to make aDec a Decimal.
aDec = 234.456784D
' The following line of code sets aDbl to 1.9225456288E+1.
aDbl = CDbl(aDec * 8.2D * 0.01D)

CDec 範例CDec Example

下列範例會使用CDec函數來轉換數值DecimalThe following example uses the CDec function to convert a numeric value to Decimal.

Dim aDouble As Double
Dim aDecimal As Decimal
aDouble = 10000000.0587
' The following line of code sets aDecimal to 10000000.0587.
aDecimal = CDec(aDouble)

CInt 範例CInt Example

下列範例會使用CInt函式,將值轉換成IntegerThe following example uses the CInt function to convert a value to Integer.

Dim aDbl As Double
Dim anInt As Integer
aDbl = 2345.5678
' The following line of code sets anInt to 2346.
anInt = CInt(aDbl)

CLng 範例CLng Example

下列範例會使用CLng函式來將值轉換成LongThe following example uses the CLng function to convert values to Long.

Dim aDbl1, aDbl2 As Double
Dim aLng1, aLng2 As Long
aDbl1 = 25427.45
aDbl2 = 25427.55
' The following line of code sets aLng1 to 25427.
aLng1 = CLng(aDbl1)
' The following line of code sets aLng2 to 25428.
aLng2 = CLng(aDbl2)

CObj 範例CObj Example

下列範例會使用CObj函數來轉換數值ObjectThe following example uses the CObj function to convert a numeric value to Object. Object變數本身包含只有四位元組指標,指向Double指派給它的值。The Object variable itself contains only a four-byte pointer, which points to the Double value assigned to it.

Dim aDouble As Double
Dim anObject As Object
aDouble = 2.7182818284
' The following line of code sets anObject to a pointer to aDouble.
anObject = CObj(aDouble)

CSByte 範例CSByte Example

下列範例會使用CSByte函數來轉換數值SByteThe following example uses the CSByte function to convert a numeric value to SByte.

Dim aDouble As Double
Dim anSByte As SByte
aDouble = 39.501
' The following line of code sets anSByte to 40.
anSByte = CSByte(aDouble)

CShort 範例CShort Example

下列範例會使用CShort函數來轉換數值ShortThe following example uses the CShort function to convert a numeric value to Short.

Dim aByte As Byte
Dim aShort As Short
aByte = 100
' The following line of code sets aShort to 100.
aShort = CShort(aByte)

CSng 範例CSng Example

下列範例會使用CSng函式來將值轉換成SingleThe following example uses the CSng function to convert values to Single.

Dim aDouble1, aDouble2 As Double
Dim aSingle1, aSingle2 As Single
aDouble1 = 75.3421105
aDouble2 = 75.3421567
' The following line of code sets aSingle1 to 75.34211.
aSingle1 = CSng(aDouble1)
' The following line of code sets aSingle2 to 75.34216.
aSingle2 = CSng(aDouble2)

CStr 範例CStr Example

下列範例會使用CStr函數來轉換數值StringThe following example uses the CStr function to convert a numeric value to String.

Dim aDouble As Double
Dim aString As String
aDouble = 437.324
' The following line of code sets aString to "437.324".
aString = CStr(aDouble)

下列範例會使用CStr要轉換的函式Date值來String值。The following example uses the CStr function to convert Date values to String values.

Dim aDate As Date
Dim aString As String
' The following line of code generates a COMPILER ERROR because of invalid format.
' aDate = #February 12, 1969 00:00:00#
' Date literals must be in the format #m/d/yyyy# or they are invalid.
' The following line of code sets the time component of aDate to midnight.
aDate = #2/12/1969#
' The following conversion suppresses the neutral time value of 00:00:00.
' The following line of code sets aString to "2/12/1969".
aString = CStr(aDate)
' The following line of code sets the time component of aDate to one second past midnight.
aDate = #2/12/1969 12:00:01 AM#
' The time component becomes part of the converted value.
' The following line of code sets aString to "2/12/1969 12:00:01 AM".
aString = CStr(aDate)

CStr 一律會呈現Date目前地區設定,例如,標準的簡短格式的值 」 時間 2003 年 6 月 15 日下午 4:35:47"。CStr always renders a Date value in the standard short format for the current locale, for example, "6/15/2003 4:35:47 PM". 不過,CStr抑制中性值的 1/1/0001 的日期和時間為 00:00:00。However, CStr suppresses the neutral values of 1/1/0001 for the date and 00:00:00 for the time.

如需詳細資訊,所傳回的值CStr,請參閱 < CStr 函式的傳回值For more detail on the values returned by CStr, see Return Values for the CStr Function.

CUInt 範例CUInt Example

下列範例會使用CUInt函數來轉換數值UIntegerThe following example uses the CUInt function to convert a numeric value to UInteger.

Dim aDouble As Double
Dim aUInteger As UInteger
aDouble = 39.501
' The following line of code sets aUInteger to 40.
aUInteger = CUInt(aDouble)

CULng 範例CULng Example

下列範例會使用CULng函數來轉換數值ULongThe following example uses the CULng function to convert a numeric value to ULong.

Dim aDouble As Double
Dim aULong As ULong
aDouble = 39.501
' The following line of code sets aULong to 40.
aULong = CULng(aDouble)

CUShort 範例CUShort Example

下列範例會使用CUShort函數來轉換數值UShortThe following example uses the CUShort function to convert a numeric value to UShort.

Dim aDouble As Double
Dim aUShort As UShort
aDouble = 39.501
' The following line of code sets aUShort to 40.
aUShort = CUShort(aDouble)

另請參閱See also