From the course: C# Practice: Attributes
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution: Reflection - C# Tutorial
From the course: C# Practice: Attributes
Solution: Reflection
- [Instructor] This is my solution to the challenge. Now, the way reflection works is there are multiple avenues that we could approach this. We can also work with link and some of the link operators. So your solution may be different than mine. This is how I solved it. So the first thing I did in the check for unit test method is I created a list of integers or I new up a new list of integers and I'll return that from this method. Next step is to get the methods on the collectible card class. So I use type of to get the type of this card, and then I call get methods. And then I'm only interested in some of the methods that might be declared in the type. So I'm using these binding flags. I only want instance methods that are public, and I'm only interested in the methods that are declared in my type. I'm not interested in any of the methods that are declared in any of its base classes. It gives me all the methods.…