0

Is it possible to get generic type arguments from within the executed generic method without directly referencing them (i.e. typeof(T0))? For example:

public static List<(T0?, T1?, T2?, T3?, T4?)> ParseParameter<T0, T1, T2, T3, T4>(this JArray array, params string[] columnCodesCaseIndependent)
{
    var genericArgs = MethodBase.GetCurrentMethod()!.GetGenericArguments();
    
    // ...

    return result;
}

Testing the above in debugger I see:

  1. {Name="T0", FullName=null}
  2. same as above for the rest

So the types are not the ones actually used. net5.0

aleksander_si
  • 1,021
  • 10
  • 28

0 Answers0