C
C#2y ago
Dultus

❔ Get full namespace name

Hey, is there a way to get the full name of a namespace? E.g. nameof(DiscordBarista.Function.Partnership.Events) gives me "Events" but I want "Project_Sipster.DiscordBarista.Function.Partnership.Events" returned.
7 Replies
basically, i am little cat
typeof(Whatever).Namespace iirc
Dultus
DultusOP2y ago
Yes, but typeof requires a class. I can't pass in a Namespace name.
basically, i am little cat
but you have a class in that namespace shook can just have a constant then ig, not sure. wait for someone who is more experience than me blobshrug
Dultus
DultusOP2y ago
Yeah, a couple. But I'd prefer a version in which I don't take any class of a namespace. ^^ Thanks tho!
Anton
Anton2y ago
no, you can't not as a constant
cap5lut
cap5lut2y ago
actually u could, but its extremely over kill and a bit more complex: u could make the class that should contain the namespace partial and generate the namespace's full qualified name via a source generator
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?