0

I have a generic method like this-

public static void GenericMethod<T1,T2>(SomeType typeObj, List<T1> entities) where T2 : SomeEntity
{
}

And I'd like to pass this method to another one as Action. Like this-

public void CallingMethod(type1 value1, type2 value, Action<???> method)
{
}

I can't figure out how to write the Action parameter. Any help please? Thanks in advance.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364

1 Answers1

1

erm,

public void CallingMethod(
        type1 value1,
        type2 value,
        Action<SomeType, List<type1>> method)
{
}

presumably but, you don't make what you want to achieve clear in your question.


If you want to accept some undefined generic action, then the method you call will need generic type parameters.

public void CallingMethod<T1>(
        type1 value1,
        type2 value,
        Action<SomeType, List<T1>> method)
{
}
Jodrell
  • 34,946
  • 5
  • 87
  • 124