what does this attribute do: MethodImplOptions.NoInlining (or: what is ‘inlining’ a method) [duplicate]

Inlining a method/property means that the compiler takes it and replaces the calls to it with its contents (making sure correct variables etc). This is not something that is C# specific.

This is done for performance normally.

For example, with this method and call:

private long Add(int x, int y)
{
   return x + y;
}

var z = Add(x, y);

The compiler may inline it as (eliminating the method in the process):

var z = x + y;

The Wikipeida article Inline expansion starts with:

In computing, inline expansion, or inlining, is a manual or compiler optimization that replaces a function call site with the body of the callee. This optimization may improve time and space usage at runtime, at the possible cost of increasing the final size of the program (i.e. the binary file size).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)