https://github.com/Rick-van-Dam/Mirror
Making reflection fast and simple
https://github.com/Rick-van-Dam/Mirror
caching csharp invokedynamic netcore reflection
Last synced: 9 months ago
JSON representation
Making reflection fast and simple
- Host: GitHub
- URL: https://github.com/Rick-van-Dam/Mirror
- Owner: Rick-van-Dam
- Created: 2018-03-19T19:02:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T12:10:11.000Z (over 8 years ago)
- Last Synced: 2025-10-10T23:28:26.456Z (9 months ago)
- Topics: caching, csharp, invokedynamic, netcore, reflection
- Language: C#
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mirror
How to do Reflection fast while keeping a simple API.
## What is this?
This little library makes it easy to get a `Func` when given only a type, methodname and optionaly some generic parameters. The main advantage of this is that its alot faster to invoke a a `Func` than it is to use `MethodInfo.Invoke`. Some performance numbers:

As you can see creating the delegate is expensive but once you have it its alot faster than `MethodInfo.Invoke` and comes within the same order of magnitude as a interface call.
## What is this not?
A complete reflection framework. Iam trying to keep this as simple as possible and purely focusing on invoking a method using reflection as fast as possible. The main reason this repo exists is for other ppl to learn how to do this but feel free to use the code. I have tried to unit test as many cases as possible to eliminate any bugs.
## Quickstart
The code that does the heavy lifting can be found [here](https://github.com/Barsonax/Mirror/blob/master/Mirror/DelegateFactory.cs). To find a example of how to use this you can check [this](https://github.com/Barsonax/Mirror/blob/master/Mirror.Example/Program.cs).