mardi 22 août 2023

Call ImmutableArray

I am trying to call create an immutable array given an object variable that actually has a type of an T[] under the hood. How to do that using a Reflection. The problem is ImmutableArray.Create has many overloads and I get an ambigous method exception.

var method = typeof(ImmutableArray).GetMethod(nameof(ImmutableArray.Create)).Invoke(null, arr);




Aucun commentaire:

Enregistrer un commentaire