Join Ted Neward for an in-depth discussion in this video Invoking methods, part of CLR Reflection for Developers.
- [Instructor] Now, just as you might well imagine…by the virtue of the fact…that I can invoke properties reflectively,…yep, I can also invoke methods reflectively.…And again, it's going to be very much the same pattern.…We can obtain a MethodInfo object…in the same mechanisms that we've used before to look at it.…Once we have the MethodInfo,…then we use the Invoke method.…Again, very similar to what we did with the constructor,…we use the Invoke method to kick off that method call.…Now, unlike the constructor,…we will need to pass an object instance in,…just like we did with properties,…to know which object on which to invoke this method.…
Now, if this is a static method,…typically this object instance will be null.…And then we'll need to pass in any parameters,…the array of objects.…Again, just like what we did with the constructor.…And if there is an object instance that is returned,…or null if it's a method call,…then it'll be of type object…just as we saw originally with the constructor.…So, in many respects, having looked at constructors,…
- Working with the IL Disassembler (Ildasm)
- Namespaces and types
- Type API
- Properties API
- MethodBase and MethodInfo API
- Constructors API
- Fields API
- Constructing objects
- Accessing properties and fields
- Invoking methods
Skill Level Intermediate
Deploying .NET Applications with Octopus Deploywith Floyd Hilton1h 27m Intermediate
2. IL Disassembler (Ildasm)
3. Reflection Namespace and Types
4. Type API
5. Properties API
6. MethodBase and MethodInfo API
7. Constructors API
Constructors API demo2m 52s
8. Fields API
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.