It looks cool on MSDN:
Specifies that the method is declared, but its implementation is
provided elsewhere.
So I tried it in a console application:
public class Program
{
[MethodImplAttribute(MethodImplOptions.ForwardRef)]
public static extern void Invoke();
static void Main(string[] args)
{
Invoke();
Console.Read();
}
}
Then what should I do now? Where can I provide the implementation of Program.Invoke?
My understanding is that
ForwardRefacts in the same way asextern, and is intended for guiding the runtime when the language you are using lacks direct support (viaexternin C#). As such, the usage should be very similar to theexternmodifier, most notably using[DllImport(...)].