mardi 21 mai 2019

C# - See if MemberInfo matches BindingFlags

I need to see if a MemberInfo matches a particular BindingFlags. The closest method to this is Type#GetMember(string, BindingFlags)

I cannot find any method to do this.

I want to do something like this

private List<MemberInfo> _members;

public IEnumerable<MemberInfo> GetMembers(BindingFlags flags)
{
    foreach(var member in _members)
    {
        if(member.MatchesFlags(flags))
        {
             yield return member;
        }
    }
}





Aucun commentaire:

Enregistrer un commentaire