# HOW TO：呼叫運算子程序 (Visual Basic)How to: Call an Operator Procedure (Visual Basic)

### 若要呼叫運算子程序To call an operator procedure

1. 在運算式中使用運算子符號，以一般方式。Use the operator symbol in an expression in the ordinary way.

2. 請確定資料類型的運算元是適用於運算子，且有正確的順序。Be sure the data types of the operands are appropriate for the operator, and in the correct order.

3. 如預期般，運算子會提供給運算式的值。The operator contributes to the value of the expression as expected.

### 若要呼叫的轉換運算子程序To call a conversion operator procedure

1. 使用CType在運算式中。Use CType inside an expression.

2. 請確定資料類型的運算元會適當轉換，並以正確的順序。Be sure the data types of the operands are appropriate for the conversion, and in the correct order.

3. CType 呼叫轉換運算子程序，並傳回已轉換的值。CType calls the conversion operator procedure and returns the converted value.

## 範例Example

Dim firstSpan As New TimeSpan(3, 30, 0)
Dim secondSpan As New TimeSpan(1, 30, 30)
Dim combinedSpan As TimeSpan = firstSpan + secondSpan
Dim s As String = firstSpan.ToString() &
" + " & secondSpan.ToString() &
" = " & combinedSpan.ToString()
MsgBox(s)