By convention, attribute class names are post-pended with ' Attribute ' (we have named our attribute classes Author Attribute , StatusOfClass Attribute , and Buggy Attribute ). This is not compulsory, but it is conventional and highly recommended. You might have realized that when using the three attributes as attribute specifications in MyClass.cs , I used the shortcut Author instead of AuthorAttribute , and Buggy instead of BuggyAttribute . The C# compiler automatically searches for the AuthorAttribute class when it encounters ' Author ' in an attribute specification. [3]
You can replace the [Author] attribute tag in attribute specifications with [AuthorAttribute] with no consequences. C# gives you this flexibility. This code: 6: [ Author ("Mok","21 Dec 02")] 7: public void DoSomething(){ 8: // some code 9: } and this: 6: [ AuthorAttribute ("Mok","21 Dec 02")] 7: public void DoSomething(){ 8: // some code 9: } are therefore equivalent. |