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
Next Post
The unspoken truth about managing geeks  15 Feb 2011
Prior Post
Importing Excel data with SSIS  04 Feb 2011
Related Posts
Dependency Injection: Views  17 Aug 2019
Dependency Injection: ViewModels  10 Aug 2019
Dependency Injection: Core  27 Jul 2019
Integration Testing  20 Jul 2019
Restructuring Reducers  13 Jul 2019
Vocabulary Browser  29 Jun 2019
Revisiting ViewModelBase  15 Jun 2019
First Light  08 Jun 2019
Add Word View  25 May 2019
Add Word View Model  11 May 2019
More csharp posts »
Archives
February 2011
2011