public class CompilationRelaxationsAttribute : Attribute
Object
Attribute
CompilationRelaxationsAttribute
mscorlib
RuntimeInfrastructure
This attribute allows the user to specify whether the ordering of instruction checking is strict or relaxed. It also allows the user to specify whether or not strings are interned.
Optimizers are granted additional latitude for relaxed exceptions. A method is relaxed for certain kinds of exceptions if the innermost custom attribute System.Runtime.CompilerServices.CompilationRelaxationAttribute pertaining to that kind of exception is present and specifies to relax those kinds of exceptions. (Here, "innermost" means inspecting the method, its class, and its assembly, in that order.)[Note: For background and implementation information for relaxed exception handling, plus examples, see Annex F of Partition VI.]
[Note: See the CompilationRelaxations enumeration for a description of the kinds of exceptions that can be relaxed or made strict.]
The runtime can create one string object for each unique string literal, rather than making multiple copies. This is called string interning, which internally requires building auxiliary tables that consume memory resources. String interning can be enabled or disabled at the assembly level via this attribute.
AttributeUsageAttribute(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple=false, Inherited=false)
System.Runtime.CompilerServices Namespace
CompilationRelaxationsAttribute Constructors
CompilationRelaxationsAttribute(System.Runtime.CompilerServices. CompilationRelaxations) Constructor
CompilationRelaxationsAttribute(int) Constructor
CompilationRelaxationsAttribute Properties
CompilationRelaxationsAttribute.CompilationRelaxations Property
public CompilationRelaxationsAttribute(CompilationRelaxations relaxations)
Constructs and initializes a new instance of the CompilationRelaxationsAttribute class with the specified CompilationRelaxations value.
- relaxations
- A a bitwise OR combination of enumeration values from CompilationRelaxations that specifies the desired ordering of instruction checking and string interning.
Exception Type Condition ArgumentException For some xxx, relaxations has both Strictxxx and Relaxedxx set, or has both StringInterning and NoStringInterning set.
The relaxations flags describe whether to change exception strictness, or string interning. For exceptions of kind xxx, setting Strictxxx makes those exceptions have strict ordering, and setting Relaxedxxx makes those exceptions have relaxed ordering. Setting neither flag for xxx causes no change for exceptions of kind xxx; i.e., the strictness/relaxation for xxx defaults to what it would be if the attribute were not present. See CompilationRelaxations for a list of the xxx choices.)
System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class, System.Runtime.CompilerServices Namespace
public CompilationRelaxationsAttribute(int relaxations)
Constructs and initializes a new instance of the CompilationRelaxationsAttribute class with the specified CompilationRelaxations value.
- relaxations
- A bitwise OR combination of enumeration values from CompilationRelaxations that specifies the desired ordering of instruction checking and string interning.
Exception Type Condition ArgumentException For some xxx, relaxations has both Strictxxx and Relaxedxx set, or has both StringInterning and NoStringInterning set.
The relaxations flags describe whether to change exception strictness, or string interning. For exceptions of kind xxx, setting Strictxxx makes those exceptions have strict ordering, and setting Relaxedxxx makes those exceptions have relaxed ordering. Setting neither flag for xxx causes no change for exceptions of kind xxx; i.e., the strictness/relaxation for xxx defaults to what it would be if the attribute were not present. See CompilationRelaxations for a list of the xxx choices.)
System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class, System.Runtime.CompilerServices Namespace
public int CompilationRelaxations { get; }
Gets the set of values sent to the CompilationRelaxationsAttribute constructor that specifies the desired ordering of instruction checking and string interning.
The current set of values that specifies the desired ordering of instruction checking and string interning.
This property is read-only.
System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class, System.Runtime.CompilerServices Namespace