'TryCast' 運算元必須為參考型別,但 '<typename>' 是實值型別

更新:2007 年 11 月

TryCast 運算子至少有一個引數是實值型別。

TryCast 會測試兩個引數之間的繼承 (Inheritance) 或實作 (Implementation) 關係。因此,它只允許引數具有參考型別。如需詳細資訊,請參閱實值型別和參考型別

錯誤 ID:BC30792

若要更正這個錯誤

  • 使用 DirectCast 或 CType 執行轉換。這兩者都可以有實值型別。

請參閱

概念

實值型別和參考型別

參考

TryCast

DirectCast

CType 函式