2 <clause number="17.5.7" title="External methods">
3 <paragraph>When a method declaration includes an extern modifier, the method is said to be an external method. External methods are implemented externally, typically using a language other than C#. Because an external method declaration provides no actual implementation, the <non_terminal where="17.5">method-body</non_terminal> of an external method simply consists of a semicolon. </paragraph>
4 <paragraph>The mechanism by which linkage to an external method is achieved, is implementation-defined. </paragraph>
6 <example>[Example: The following example demonstrates the use of the extern modifier in combination with a DllImport attribute that specifies the name of the external library in which the method is implemented: <code_example><![CDATA[
8 using System.Security.Permissions;
9 using System.Runtime.InteropServices;
12 [DllImport("kernel32", SetLastError=true)]
13 static extern bool CreateDirectory(string name, SecurityAttribute sa);
14 [DllImport("kernel32", SetLastError=true)]
15 static extern bool RemoveDirectory(string name);
16 [DllImport("kernel32", SetLastError=true)]
17 static extern int GetCurrentDirectory(int bufSize, StringBuilder buf);
18 [DllImport("kernel32", SetLastError=true)]
19 static extern bool SetCurrentDirectory(string name);
21 ]]></code_example>end example]</example>