私はvb.netでパブリッククラスを持つパブリッククラスを持っています。コンストラクタは実行されていないようです。私は中断しないコンストラクタにブレークポイントを持っています。また、データベースを更新すると、新しい値が辞書に表示されません。実行するパブリッククラスのコンストラクタを取得する方法
Public Class SkywalkerPolicy
Public Shared CustomPolicies As Dictionary(Of String, String)
Shared Sub New()
CustomPolicies = New Dictionary(Of String, String)
Dim bvin As String = String.Empty
Dim title As String = String.Empty
Dim poldescr As String = String.Empty
Dim dtResult As New DataTable("Result")
dtResult.Locale = System.Globalization.CultureInfo.InvariantCulture
Dim request As New DataRequest
request.Command = "sky_PolicyDictionary_s"
request.CommandType = CommandType.StoredProcedure
request.Transactional = False
Dim result As DataSet
result = SqlDataHelper.ExecuteDataSet(request)
If Not result Is Nothing Then
If result.Tables.Count() > 0 Then
dtResult = result.Tables(0)
For Each row In dtResult.AsEnumerable
bvin = row.Item(1)
title = row.Item(0)
poldescr = row.Item(2)
If CustomPolicies.ContainsKey(title) Then
CustomPolicies(title) += poldescr
Else
CustomPolicies.Add(title, poldescr)
End If
Next
End If
End If
End Sub
End Class
辞書にアクセスすると、データに行った変更は表示されません。
Dim pol As String = SkywalkerPolicy.CustomPolicies("Orders and Shipping Details")
どのように私は動作するようにコンストラクタを得ることができますか?
私はそれを使用する前に辞書を初期化する複製を追加する必要がありますか?
おかげ
あなたは例えば...どこかにオブジェクトとしてクラスをインスタンス化しています。プライベートMyPolicy =新しいSkywalkerPolicy? –
は、新しい方法が –
を実行する必要があり、私はただの文字列= MyPolicy.CustomPolicies(「受注及び発送詳細」)として暗いMYPOLICY =新SkywalkerPolicy 薄暗いPOL \t \t \tように私は、共有メンバーのアクセスも、一定のメンバー、列挙型のメンバを取得することを試みましたまたはインスタンスを介してネストされた型。修飾表現は評価されません。 – Roger