掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
参照型変数がNothingの場合でもその変数の型を取得するには? (ID:146116)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
> だとしたら、リフレクションを用いることで調べられるかと思います。 そこまでせずとも、「型推論」を使えば、簡単に調べられるかな。 Public Class Form1 Private Sub Form1_Load() Handles MyBase.Load Dim f0 As Form = Nothing Dim f1 As Form1 = Nothing Dim f2 As Form2 = Nothing MsgBox(GetVarType(f0).FullName) MsgBox(GetVarType(f1).FullName) MsgBox(GetVarType(f2).FullName) End Sub Function GetVarType(Of T)(ByVal var As T) As Type Return GetType(T) End Function End Class
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.