Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Reflection;
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static class AssemblyExtensions
- {
- /// <summary>
- /// Whether the assembly was compiled with the optimize+ flag
- /// </summary>
- /// <param name="asm">The assemlby to verify the optimization flag</param>
- /// <returns>
- /// true if no <see cref="DebuggableAttribute"/> exists or
- /// <see cref="DebuggableAttribute.IsJITOptimizerDisabled"/> is false,
- /// otherwise, false.
- /// </returns>
- public static bool IsOptimized(this Assembly asm)
- {
- var att = asm.GetCustomAttribute<DebuggableAttribute>();
- return att == null || att.IsJITOptimizerDisabled == false;
- }
- }
Add Comment
Please, Sign In to add comment