C
C#9mo ago
TOKYODRIFT!

✅ 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?
1 Reply
TOKYODRIFT!
TOKYODRIFT!9mo ago
public bool UseDC1 { get; set; }
public bool UseDC2 { get; set; }
public bool UseDC1 { get; set; }
public bool UseDC2 { get; set; }
hm it works I don't know why but nameof didn't work before 🤡 thanks