Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5934913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:10:51+00:00 2026-05-22T15:10:51+00:00

Been going through some framework classes using reflector and noticed a number of the

  • 0

Been going through some framework classes using reflector and noticed a number of the methods and properties have the following attribute

[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]

I’m pretty sure I have also seen the above comment somewhere else and never followed it up.

Could someone please tell me what this means in the C# and any other context?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:10:52+00:00Added an answer on May 22, 2026 at 3:10 pm

    It tells NGen that it is OK to inline the method it’s applied to even in a different assembly.

    For example:

    • String.Equals has [TargetedPatchingOptOut]
    • You write a program that calls String.Equals
    • You run NGen on this program for maximum performance
    • NGen will inline the String.Equals call, replacing the method call instruction with the actual code in the method.
      Method calls are (slightly) expensive, so this is a performance boost for frequently-called methods.

    However, if Microsoft finds a security hole in String.Equals, they cannot just update mscorlib.dll, because that won’t affect the assembly that you just NGen’d. (Since it has raw machine code without referencing String.Equals).
    I assume that if that were to actually happen, the security update would clear the NGen store.

    Note that this attribute is only useful in the .NET Framework assemblies. You don’t need it in your own. You can find more information about that here: https://stackoverflow.com/a/14982340/631802

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been going through some C source code and I noticed the following: void
I have been tasked with going through a number of ColdFusion sites that have
I have been using C# for a while now, and going back to C++
I've been going through the tutorials (specifically ones using Linq-To-Entities) and I understand the
I have been looking into using the Entity Framework in my C# game server
I've been going through some old code, where I came across some custom defined
after going through some basic tutorials on the app engine and the webapp framework,
Similar questions have been asked before but after a day of going through the
Possible Duplicate: Mongo interface I have been going through the GUI tools available for
I'm interested in becoming more fluent in Java so I have been going through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.