c# - What is the most efficient way to ask a MethodInfo how many parameters it takes? -
what efficient way ask methodinfo if accepts parameters and, if so, how many?
my current solutions be: methodinfo.getparameters().any() , methodinfo.getparameters().count().
is efficient way?
since don't need of parameterinfo objects, there way without call getparameters()?
the 2 listed linq. any() returns bool - stating there @ least one. count() used on ienumerable<t>.
length (the property) fastest because getparameters() returns parameterinfo[].
it not appear methodinfo have other way access number of parameters other getparameters().
Comments
Post a Comment