I have seen that in some cases we use following syntax format in c#,
[something]
void methodM(){
}
Example :
[MethodImpl(MethodImplOptions.Synchronized)]
public void SomeMethod() {/* code */}
[WebMethod]
public void MyWebMethod(){/* code */}
How this works at the compilation?
Explanation
Those are attributes or annotations. They are kind of metadata for the member they are placed on.
For example, using MethodImpl attribute, you can specify the details of how a method is implemented. And using WebMethod attribute, you mark that method as a web service method.
Further reading:
Attributes (C# Programming Guide)
Attributes in C#