System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class

public class CompilationRelaxationsAttribute : Attribute

Base Types

Object
  Attribute
    CompilationRelaxationsAttribute

Assembly

mscorlib

Library

RuntimeInfrastructure

Summary

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.

Description

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.

Attributes

AttributeUsageAttribute(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple=false, Inherited=false)

See Also

System.Runtime.CompilerServices Namespace

Members

CompilationRelaxationsAttribute Constructors

CompilationRelaxationsAttribute(System.Runtime.CompilerServices. CompilationRelaxations) Constructor
CompilationRelaxationsAttribute(int) Constructor

CompilationRelaxationsAttribute Properties

CompilationRelaxationsAttribute.CompilationRelaxations Property


CompilationRelaxationsAttribute(System.Runtime.CompilerServices. CompilationRelaxations) Constructor

public CompilationRelaxationsAttribute(CompilationRelaxations relaxations)

Summary

Constructs and initializes a new instance of the CompilationRelaxationsAttribute class with the specified CompilationRelaxations value.

Parameters

relaxations
A a bitwise OR combination of enumeration values from CompilationRelaxations that specifies the desired ordering of instruction checking and string interning.

Exceptions

Exception TypeCondition
ArgumentExceptionFor some xxx, relaxations has both Strictxxx and Relaxedxx set, or has both StringInterning and NoStringInterning set.

Description

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.)

See Also

System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class, System.Runtime.CompilerServices Namespace

CompilationRelaxationsAttribute(int) Constructor

public CompilationRelaxationsAttribute(int relaxations)

Summary

Constructs and initializes a new instance of the CompilationRelaxationsAttribute class with the specified CompilationRelaxations value.

Parameters

relaxations
A bitwise OR combination of enumeration values from CompilationRelaxations that specifies the desired ordering of instruction checking and string interning.

Exceptions

Exception TypeCondition
ArgumentExceptionFor some xxx, relaxations has both Strictxxx and Relaxedxx set, or has both StringInterning and NoStringInterning set.

Description

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.)

See Also

System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class, System.Runtime.CompilerServices Namespace

CompilationRelaxationsAttribute.CompilationRelaxations Property

public int CompilationRelaxations { get; }

Summary

Gets the set of values sent to the CompilationRelaxationsAttribute constructor that specifies the desired ordering of instruction checking and string interning.

Property Value

The current set of values that specifies the desired ordering of instruction checking and string interning.

Description

This property is read-only.

See Also

System.Runtime.CompilerServices.CompilationRelaxationsAttribute Class, System.Runtime.CompilerServices Namespace