迭代后期绑定对象枚举

时间:2010-11-17 20:02:09

标签: .net

Public Class ScoringStrategyEntity

    Public Enum TotalingMethodType
        Weighted_Share
        Multiply_Components
    End Enum

Private _TotalingMethod As TotalingMethodType
    Public Property TotalingMethod() As TotalingMethodType
        Get
            Return _TotalingMethod
        End Get
        Set(ByVal value As TotalingMethodType)
            _TotalingMethod = value
        End Set
    End Property

End Class

Dim ScoringStrategy As Object = Activator.CreateInstance("MyDll", "MyDll.ScoringStrategyEntity").Unwrap()

For Each Enum In ScoringStrategy.TotalingMethodType

Next

1 个答案:

答案 0 :(得分:2)

如果您的意思是“如何从Type获取可用的枚举值?”,那么(仅使用C#语法作为示例; 方法应该在VB中工作):

var values = Enum.GetValues(typeof(ScoringStrategy.TotalingMethodType));