I'm performing some reflective interrogation of an object. The code lists constructor(s), properties, and methods. GetMethods( )
returns property accessor/mutator methods and event add/remove methods.
How can I get just the basic method definitions?
Update
.IsSpecialName
is the operative property. Thanks, @Hans.
The following answer from this post Filtering out auto-generated methods getter/setter/add/remove/.etc) returned by Type.GetMethods() should work
typeof(MyType)
.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
.Where(m => !m.IsSpecialName)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With