The Offending Acts of Bodgery
- Use of Module
Cos, I can't write base-class only methods. - Use of reflection
Unable to refer to static method on the Type specified by the Generic Type Parameter.
VS suggest using Token.Parser which isn't the method in the derived type.
Public Module TokenModule
Public Function Parse(Of T As Token)(cr As CharReader) As T
'
' Here Be Nasty Reflection Based Bodge Job
'
' Why? What I want to write. ( Call a static method on the generic (constrianed) type specifier.)
'
' Return T.Parser(cr)
'
' Start Bodgery {
Dim tt As T
tt = GetType(T).InvokeMember("Parser",
Reflection.BindingFlags.InvokeMethod +
Reflection.BindingFlags.NonPublic +
Reflection.BindingFlags.Static, Nothing, tt, {cr})
Return tt
' } End Bodgery
End Function
End Module
It would be so much nicer to write if it supported Partial Inheritance.
Spoiler

New Topic/Question
Reply




MultiQuote


|