Restricting Attribute usages only for Public and Protected Variables c#
attributes, c#
Solution
No, you can't do that. You can restrict attribute usage only based on the type of the target, not anything else.
[AttributeUsage(AttributeTargets.Method)]
public class MethodOnlyAttribute : Attribute {
}
Problem
Is it possible to restrict an attribute usage to just protected and public variables. I just want to restrict to private variables.