extern
suggest changeThe extern keyword declares a method that is implemented elsewhere. With DllImport, the method is also static and calls unmanaged code.
For Example:
using System.Runtime.InteropServices;
public class MyClass
{
[DllImport("User32.dll")]
private static extern int SetForegroundWindow(IntPtr point);
public void ActivateProcessWindow(Process p)
{
SetForegroundWindow(p.MainWindowHandle);
}
}
This uses the SetForegroundWindow method imported from the User32.dll library
extern alias lets one assembly reference two versions of a component that share fully qualified type names.
To reference two assemblies with the same fully-qualified type names, an alias must be specified at a command prompt, as follows:
/r:GridV1=grid.dll
/r:GridV2=grid20.dll
This creates the external aliases GridV1 and GridV2. To use these aliases from within a program, reference them by using the extern keyword. For example:
extern alias GridV1;
extern alias GridV2;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents