✅ Roslyn: Get file scoped namespace
Hi, i'm using the new file scoped namespace
I try to extract the namespace like this
but
@namespace
is null. Why is that?6 Replies
using namespace TestNameSpace;
?
is it really that, or did you just typo the using
?That was just a typo, sorry, but good catch
But dammit, i found the issue 😄 they surprisingly added a new class for file-scoped namespaces...
FileScopedNamespaceDeclarationSyntax
Researhing a good method to get namespace for every situation, i came across a method like this, maybe it helps in the future too
Thanks for sharing your code! 🙂 That's what i was planning to do right now, like traversing the parents, because I figured out the file scoped namespace syntax is not a sibling of the class declaration syntax, but a parent.. that's kinda wild 😄
but it also makes sense logically
your code seems to fit my needs, thanks 🙂
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered