lundi 27 juillet 2020

How do I pass a struct argument to a MethodInfo if the struct has a ReadOnlySpan field

I have a MethodInfo object that represents a method, and that method takes a struct as an argument, and that struct has a ReadOnlySpan<byte> field. How do I invoke the method via the MethodInfo object? I can't use MethodInfo.Invoke because Invoke requires the parameters as an object?[]? array and a struct with a ReadOnlySpan<byte> field can't be cast to an object.

So how can I invoke a method via reflection and pass it a struct value where that struct has a field of type ReadOnlySpan?





Aucun commentaire:

Enregistrer un commentaire