Extern member cannot declare a body
CodeRush Classic shows the Extern member cannot declare a body code issue if an extern member declares a body.
#Fix
Remove the extern method body.
#Purpose
Highlights the extern method declaration statements, which would cause the Cannot be extern and declare a body compilation error.
#Example
[DllImport("user32.dll")]
static extern int │DrawText(IntPtr hDC, string lpString, int nCount, ref Rect lpRect, uint uFormat)
{
}
Fix:
[DllImport("user32.dll")]
static extern int DrawText(IntPtr hDC, string lpString, int nCount, ref Rect lpRect, uint uFormat);