I didn't delete the first comment in case it might be useful to other people in the future. I made some changes for the code you refreshed. I tried to create a generic structure as much as possible. However, Javascript is much more flexible than C#. In other words, even if the structure is generic, at some points we have to break this genericity.
static void Main(string[] args)
{
MainFunction<string, string, int>("a", "b", FunctionToPass2<int, int, int>);
Console.ReadLine();
}
static void FunctionToPass1<T1, T2>(T1 x, T2 y)
{
Console.WriteLine(x + " " + y);
}
static void FunctionToPass2<T1, T2, T3>(T1 x, T2 y, T3 z)
{
Console.WriteLine(x + " " + y + " " + z);
}
static void MainFunction<T1, T2, T3>(T1 param1, T2 param2, Action<T3, T3, T3> functionToPass)
{
Console.WriteLine(param1 + " " + param2 + "\n");
FunctionToPass2(1, 2, 3);
}
If our parameter types are certain, I believe we will come up with a much simpler solution by not writing it generic. For example, I assume that T3 for Action<T3, T3, T3> delegate is int for this solution because your arguments are integer. Here we have to break the 'generic' structure a bit.