lundi 11 avril 2022

How pass Type to Method

I have method like below:

public void Method<TEntity>()
{
    //do some works
}

Problem is here that i can't cat type to TEntity.

foreach (var type in types)
{
    //i want pass type as T to method
    Method<type>();
}

What is the recommended way of doing this?

Thanks in advance.





Aucun commentaire:

Enregistrer un commentaire