Fresh from Twitter, here are some ways to use attributes in C# that you might not know …
Did you know you can put attributes on method parameters …
public string MyMethod([MyCustomAttribute] int id)
{
// ...
}
Did you know you can specify an attribute on the return of a method …
[return: CrazyAttributeOnAReturnMethod(WithAParameterOfItsOwn = true)]
public string MyMethod(int id)
{
// ...
}
For the record: I knew the first, but not the second …
Comments
blog comments powered by Disqus