C
C#10mo ago
TOKYODRIFT!

❔ It it possible to get name of attribute without reflection?

I have following:
public class Book
{
[CustomAttribute]
public string Name
{
get; private set;
}
}
public class Book
{
[CustomAttribute]
public string Name
{
get; private set;
}
}
is it possible to get the name of CustomAttribute? with type.GetCustomAttribute?
2 Replies
Angius
Angius10mo ago
typeof(CustomAttribute).Name maybe? Besides that, no, attributes are made to be used with reflections and sourcegen
Accord
Accord10mo 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.