I am using Type.GetMember
to get enum
member. And when my enum value is Equals
. It returns the Equals
method which is inherited from object. So how could i retrieve only the enum member and not the members from object.
Enum
enum MyEnum{
Equals,
NotEquals
}
MemberInfo[] member = typeof(MyEnum).GetMember("Equals");
//Returns both Equals method from object and also the member from enum.
So how could i get the Equals
from enum
alone?
You need to use a binding flag:
Or just use
GetField
: