what is [] brackets in .net?

Freshblood picture Freshblood · Jun 3, 2010 · Viewed 54.9k times · Source

i have seen [] such brackets in c# very very rarely but when i start to learn asp.net i have seen them many times but still i couldn't understand what they does ?

They are not part of code as using for arrays.For example [webmethods] which is just over the methods or there are some over classes. Are they part of .net or they are just tell something to CLR ? or ?

Answer

Jouke van der Maas picture Jouke van der Maas · Jun 3, 2010

They are used to put Attributes on classes or methods (or other stuff). That way, you can attach data to classes that should not be part of the actual class. You can read more on them here