Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/barsonax/mirror
Making reflection fast and simple
https://github.com/barsonax/mirror
caching csharp invokedynamic netcore reflection
Last synced: 19 days ago
JSON representation
Making reflection fast and simple
- Host: GitHub
- URL: https://github.com/barsonax/mirror
- Owner: Barsonax
- Created: 2018-03-19T19:02:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T12:10:11.000Z (over 6 years ago)
- Last Synced: 2024-10-11T20:39:00.361Z (about 1 month ago)
- Topics: caching, csharp, invokedynamic, netcore, reflection
- Language: C#
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 2
- 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).