Press "Enter" to skip to content

Get everything from .Net Reflection

Mohammad Sina Karvandi 1

In the previous posts, I’d explained about low-level languages and play around kernel-mode reversing but now let’s dig into the high-level languages.
In this post, I’m gonna share a comprehensive method that took more than two weeks for me to build such small and perfect function to play with .Net framework reflection.
I also share this functions in my GitHub which can be accessed through this link.

.Net reflection gives .net framework a high flexibility by dynamically invoking functions from .net IL files and it has good features which can be used in order to build a plugin-based application in both desktop applications and web applications.

But for now, let me show you what these functions are and how we can use them.

I create two methods to cover all the possibilities in which a target function can be defined, the first one is for situations where you have a function that doesn’t need any argument.

It implemented as below :

and the second one :

The second one is used for situations where you wanna pass the parameter(s) to the function.

For instance …

Consider you built a class library (.dll plugin) from the Visual Studio with the following syntax :

If you want to call MyPluginFunction1 then you should use the second method which gives an array of object to pass to the method.

If you want to call MyPluginFunction2 then you should use the first method which invokes the method directly without any arguments.

Important Note: If you have an exception like, object reference not set to an instance it is because the method name is incorrect or you invoke a non-static function within a static function or invoke a static function within a non-static function so please keep in mind the invoker function and target function should have the same state.


This post is also available on Github :


This topic also published in Damghan University’s publication. You can find more at

  1. Mahdi Mahdi

    Great post. It helped me to make a sophisticated plugin!

Leave a Reply

Your email address will not be published. Required fields are marked *