Guest User

Untitled

a guest
Apr 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using System.ComponentModel;
  2. using System.Diagnostics;
  3. using System.Reflection;
  4.  
  5. [EditorBrowsable(EditorBrowsableState.Never)]
  6. internal static class AssemblyExtensions
  7. {
  8. /// <summary>
  9. /// Whether the assembly was compiled with the optimize+ flag
  10. /// </summary>
  11. /// <param name="asm">The assemlby to verify the optimization flag</param>
  12. /// <returns>
  13. /// true if no <see cref="DebuggableAttribute"/> exists or
  14. /// <see cref="DebuggableAttribute.IsJITOptimizerDisabled"/> is false,
  15. /// otherwise, false.
  16. /// </returns>
  17. public static bool IsOptimized(this Assembly asm)
  18. {
  19. var att = asm.GetCustomAttribute<DebuggableAttribute>();
  20. return att == null || att.IsJITOptimizerDisabled == false;
  21. }
  22. }
Add Comment
Please, Sign In to add comment