Skip to content

How to call a generic method using meta.Method.ReturnType as generic parameter? #235

Answered by gfraiteur
MEmanuelsson asked this question in Q&A
Discussion options

You must be logged in to vote

This is possible using a generic auxiliary template. See https://doc.metalama.net/conceptual/aspects/templates/auxilliary-templates#dynamic-invocation-of-generic-templates.

However, in your case, you should instead use the non-generic overload of JsonSerializer.Deserialize, this is simpler.

You may also like our ready-made caching aspect. See https://doc.metalama.net/patterns/caching.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MEmanuelsson
Comment options

Answer selected by MEmanuelsson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants