说基是基类
我想在Base派生的所有类上共享一个变量。但是,每个派生类都有其自己的共享变量。
这是怎么实现的?
Private Shared _tableOfCurrencyDictionary As Dictionary(Of String, Dictionary(Of String, BaseQuoteandBaseQuote))
Protected Property _tableOfCurrency As Dictionary(Of String, BaseQuoteandBaseQuote)
Get
Dim className = Me.GetType().Name
If _tableOfCurrencyDictionary.ContainsKey(className) Then
Return _tableOfCurrencyDictionary(className)
Else
Return Nothing
End If
End Get
Set(value As Dictionary(Of String, BaseQuoteandBaseQuote))
Dim className = Me.GetType().Name
_tableOfCurrencyDictionary(className) = value
End Set
End Property
还有更好的方法吗?