<Attributes>
クラス拡張のメソッドでこれを使用することは可能ですか?
こちらがAクラス
Public Class Goblin
Inherits Monster
Enum goblinsRole
Chief
Grount
End Enum
Public Property name As String
Public Property role As goblinsRole
Private healthPoints As Integer
Public Sub New(into As Integer)
healthPoints = into
End Sub
Public Sub hitBy(damage As Integer)
<...>
End Sub
<ValidationMethod()>
Public Function checkByTheWitchDoctor()
<...>
End Function
<ValidationMethod()>
Public Function isAlive()
<...>
End Function
End Class
これは、このクラス A の拡張です。
Module ModuleExtension
<ValidationMethod()>
<Extension()>
Public Sub PrintDateOfDeath(ByVal aGoblin As DomainModelFake.Goblin)
<...>
End Sub
<Extension()>
<ValidationMethod()>
Public Function smashedByAGrount(ByVal aGoblin As DomainModelFake.Goblin) As Boolean
<...>
End Function
End Module
リフレクションを使用してこの属性でタグ付けされたメソッドを取得すると、クラス A 定義にあるメソッドのリストのみが取得され、拡張機能にあるメソッドは取得されません。
エクステンソでは、それは私が見るだけであることを意味します:
- checkByTheWitchDoctor()
- 生きている()
しかし、私は見ません:
- PrintDateOfDeath()
- smashedByAGround()
これは反射の通常の動作ですか? 拡張機能を検索しませんか?