The Labs \ Source Viewer \ SSCLI \ System.Runtime.CompilerServices \ RuntimeCompatibilityAttribute

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. ////////////////////////////////////////////////////////////////////////////////
  16. ////////////////////////////////////////////////////////////////////////////////
  17. /*=============================================================================
  18. **
  19. ** Class: RuntimeCompatibilityAttribute
  20. **
  21. **
  22. ** Purpose: Mark up the program to indicate various legacy or new opt-in behaviors.
  23. **
  24. **
  25. =============================================================================*/
  26. namespace System.Runtime.CompilerServices
  27. {
  28.    
  29.     using System;
  30.    
  31.     [Serializable(), AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
  32.     public sealed class RuntimeCompatibilityAttribute : Attribute
  33.     {
  34.         // fields
  35.         private bool m_wrapNonExceptionThrows;
  36.        
  37.         // constructors
  38.         public RuntimeCompatibilityAttribute()
  39.         {
  40.             // legacy behavior is the default, and m_wrapNonExceptionThrows is implicitly
  41.             // false thanks to the CLR's guarantee of zeroed memory.
  42.         }
  43.        
  44.         // properties
  45.        
  46.         // If a non-CLSCompliant exception (i.e. one that doesn't derive from System.Exception) is
  47.         // thrown, should it be wrapped up in a System.Runtime.CompilerServices.RuntimeWrappedException
  48.         // instance when presented to catch handlers?
  49.         public bool WrapNonExceptionThrows {
  50.             get { return m_wrapNonExceptionThrows; }
  51.             set { m_wrapNonExceptionThrows = value; }
  52.         }
  53.     }
  54. }

Developer Fusion