.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Linq;
using System.Reflection;
					
public class Program
{
	public static void Main()
	{
		try
		{
			var flags = BindingFlags.Static | BindingFlags.NonPublic;
			var method = typeof(Program).GetMethod("Test", flags);
			
			var paramTypes1 = new[] { typeof(string) };
			var paramTypes2 = new[] { method.GetParameters()[0].ParameterType };
			
			var method1 = typeof(Program).GetMethod("Test", flags, null, paramTypes1, null);
			var method2 = typeof(Program).GetMethod("Test", flags, null, paramTypes2, null);
			
			Console.WriteLine("Expected:");
			Console.WriteLine(method);
			
			Console.WriteLine();
			Console.WriteLine("Actual:");
			Console.WriteLine("Manually Created Parameter Types     : {0}", method1 == null ? "NULL" : method1.ToString());
			Console.WriteLine("Reflectively Created Parameter Types : {0}", method2 == null ? "NULL" : method2.ToString());
		}
		catch (Exception e)
		{
			Console.WriteLine(e);
		}
	}
	
	private static void Test<T>(T val)
	{
	}
}
;