How do I use reflection to invoke a private method?

后端 未结 10 657
说谎
说谎 2020-11-22 14:05

There are a group of private methods in my class, and I need to call one dynamically based on an input value. Both the invoking code and the target methods are in the same i

10条回答
  •  情歌与酒
    2020-11-22 14:37

    Could you not just have a different Draw method for each type that you want to Draw? Then call the overloaded Draw method passing in the object of type itemType to be drawn.

    Your question does not make it clear whether itemType genuinely refers to objects of differing types.

提交回复
热议问题