Указание параметров для Type.GetMethodC#

Место общения программистов C#
Anonymous
Указание параметров для Type.GetMethod

Сообщение Anonymous »


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", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(string) }, null); I get a method back, but extending this slightly:

typeof(Int32).GetMethod("TryParse", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(string), typeof(Int32) }, null); I get nothing back. My spidersense is telling me it's because the second parameter is an out parameter.

Anyone know what I've done wrong here?


Источник: https://stackoverflow.com/questions/451 ... -getmethod

Вернуться в «C#»