I know you can add an attribute to methods in C# like this,
ex1.
[HttpPost]
public void Method()
{
//code
}
Which means the attribute must be satisfied to run Method().
And I know you can stack attributes like this,
ex2.
[HttpPost]
[RequireHttps]
public void Method2()
{
//More code
}
Which checks that both attribute1 ‘AND’ attribute2 are satisfied before you can use Method2().
But can you ‘OR’ Attributes? Something like this maybe?
ex3.
[HttpPost || RequireHttps]
public void Method3()
{
//Even more code
}
So if either attribute is satisfied you can use Method3().
Edit: Sorry was under the impression Attributes where called Annotations. Fixed that.
That is a misunderstanding.
The
[HttpPost]attribute is a directive, this method will only match a Post request. It is not a ‘demand’ like a security check. Only some attributes work that way.But when considering them as ‘requirements’ : they work independently so that will always result in AND behaviour.