using System; using System.Linq; using System.Collections.Generic; using System.Collections.Concurrent; using System.Reflection; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; var flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly; string[] names = typeof(Probe).GetMethods(flags).Select(method => method.Name).OrderBy(name => name, StringComparer.Ordinal).ToArray(); Console.WriteLine("declared:" + string.Join(",", names)); Console.WriteLine($"inherited:{typeof(Probe).GetMethod(nameof(Parent.Inherited)) is not null}"); Console.WriteLine($"private:{typeof(Probe).GetMethod("Secret", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)!.IsPrivate}"); class Parent { public void Inherited() { } } sealed class Probe : Parent { public void Own() { } private void Secret() { } }