Share via


Stop inlining...

If you want to prevent a method from being inlined, add:

[MethodImplAttribute(MethodImplOptions.NoInlining)]

Comments

  • Anonymous
    January 04, 2006
    Hmm... why? To test performance with and without inlining?
  • Anonymous
    January 04, 2006
    A good candidate for not using inline is when you want to call a delegate and you want to make sure than no one is updating the invocation list - what that you do in such action is to create a method that has noinline that gets the delegate and return it (remember its immutable) that way you make a copy of it automatically :)
  • Anonymous
    January 23, 2006
    Great but how about a way to force inlining? There are indeed times when I know better than the compiler and JITer and know a great deal about what I'm doing.

    Thanks,
    Shawn