C
C#4mo ago
SWEETPONY

✅ how to check attribute name?

I have following:
if (syntaxNode
is RecordDeclarationSyntax
and MemberDeclarationSyntax { AttributeLists.Count: > 0 } member)
{
MemberSyntaxes.Add(member);
}
if (syntaxNode
is RecordDeclarationSyntax
and MemberDeclarationSyntax { AttributeLists.Count: > 0 } member)
{
MemberSyntaxes.Add(member);
}
I want to check if member contains special attribute. How to do it?
2 Replies
SWEETPONY
SWEETPONY4mo ago
I tried this but it looks weird var t= member.AttributeLists.FirstOrDefault().Attributes.FirstOrDefault().Name;
Pobiega
Pobiega4mo ago
#roslyn is the go-to channel for stuff like this they can probably give you the answer of the top of their heads 🙂