How to get MethodInfo of protected and public methods only?
Please advise.
How to get MethodInfo of protected and public methods only?
Please advise.
Well, can't you just get all MemberInfos and filter them out by IsFamily and IsPublic properties?
There is no directway the thing you can do it check isfamily and ispublic flag of methodinfo
minfo = b.GetType().GetMethods("publicProtectedMember",
BindingFlags.Instance|BindingFlags.NonPublic |BindingFlags.Public);
if (minfo.IsFamily || minfo.IsPublic)
{
string s = fd.Member();
}
using System.Linq;
using System.Reflection;
var methods = foo
.GetType()
.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
.Where(m => m.IsFamily || m.IsPublic);