© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
3 replies
SWEETPONY

✅ Is it possible to use nameof in attributes?

I have this:
[UIGroup]                               
public DCSettings DC { get; set; }      
                                        
[UIGroup]                               
[Effect(                                
    source: "DC.UseDC1, DC.UseDC2",     
    values: "[true]",                   
    what: "enable")]                    
public GuardSettings Guard { get; set; }
[UIGroup]                               
public DCSettings DC { get; set; }      
                                        
[UIGroup]                               
[Effect(                                
    source: "DC.UseDC1, DC.UseDC2",     
    values: "[true]",                   
    what: "enable")]                    
public GuardSettings Guard { get; set; }


I don't like writing the name of properties using "" because name can be changed
So is it possible to write the same but with nameof?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Is it possible to use union type in C#?
C#CC# / help
3y ago
✅ Is it possible to use grouping here?
C#CC# / help
3y ago
✅ Purpose and use of nameof() keyword
C#CC# / help
12mo ago
Is it possible to use pattern matching here?
C#CC# / help
15mo ago