I have one class and I want to have custom attribute, so on class level I can do it without any problem.
Example:
[@Component]
[EnableCors(origins: "*", headers: "*", methods: "*")]
public class AuthUserController : ApiController
{
// functions and their logic ...
}
Here @Compunent is my custom attribute and EnableCors is third party attribute. I can do it without any problem, even i can read my attribute also. Below code.
type = Namespace.MyClassName.GetType();
System.Attribute[] attrs = System.Attribute.GetCustomAttributes(type);
So my question is how to apply same custom attribute on Constructor level something like this.
[@Component]
public AuthUserController(AuthenticationService objAuthenticationService)
{
// code
}
Above code is fine it is not showing any error but how to read constructor level attribute is my question. By using above first technique its not working.
Please help.