If you are looking for all the participants, regardless of whether they are available or not:
There is no public API for this, and the internal approach of the Roslyn team more or less matches what you described.
internal GetBaseTypesAndThis(). :
var tree = CSharpSyntaxTree.ParseText(@"
public class A
{
public void AMember()
{
}
}
public class B : A
{
public void BMember()
{
}
}
public class C: B //<- We will be analyzing this type.
{
public void CMember()
{
}
//Do you want this to hide B.BMember or not?
new public void BMember()
{
}
}");
var Mscorlib = MetadataReference.CreateFromAssembly(typeof(object).Assembly);
var compilation = CSharpCompilation.Create("MyCompilation",
syntaxTrees: new[] { tree }, references: new[] { Mscorlib });
var model = compilation.GetSemanticModel(tree);
var classC = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Last();
var typeC = (ITypeSymbol)model.GetDeclaredSymbol(classC);
var members = typeC.GetBaseTypesAndThis().SelectMany(n => n.GetMembers());
:
GetAccessibleMembersInThisAndBaseTypes().
, . Roslyn # 5. .
SemanticModel.LookupSymbols()