I\'m using reflection to get at the TryParse method info (upvote for the first person to guess why ;).
If I call:
typeof(Int32).GetMethod(\"Parse\",
Like @Jab's but a little shorter:
var tryParseMethod = typeof(int).GetMethod(nameof(int.TryParse),
new[]
{
typeof(string),
typeof(int).MakeByRefType()
});
// use it
var parameters = new object[] { "1", null };
var success = (bool)tryParseMethod.Invoke(null, parameters);
var result = (int)parameters[1];
Try this
typeof(Int32).GetMethod("TryParse",
BindingFlags.Static | BindingFlags.Public,
null,
new Type[] { typeof(string), typeof(Int32).MakeByRefType() },
null);