Generate multiple attribute?

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-04-12T19:30:38Z Indexed on 2010/04/12 19:33 UTC
Read the original article Hit count: 124

Filed under:
|
|

ATM i cant quiet imagine how this will work. I'm sure it can be done. I notice a pattern use in my attribute where i always use 3 specific attributes together. Take the below as an example

    [MyAttr(4, @"a"),
     MyAttr(41, "b"),
     MyAttr(45, "ab")]

Mine is much more complicated but i would like to define one attribute with more params to generate the data above. How might i do that? Lets say my one attribute will look like this

MyAttr2(4, 41, "a", "b"); //4+41=45, "a"+"b" = "ab"

How might i generate the 3 MyAttr to apply to a class using MyAttr2?

© Stack Overflow or respective owner

Related posts about c#

Related posts about attributes