System.Runtime.CompilerServices Namespace

Provides functionality for compiler writers who use managed code to specify attributes in metadata that affect the run-time behavior of the common language runtime.

Classes

AccessedThroughPropertyAttribute

Specifies the name of the property that accesses the attributed field.

AsyncIteratorStateMachineAttribute

Indicates whether a method is an asynchronous iterator.

AsyncMethodBuilderAttribute

Indicates the type of the async method builder that should be used by a language compiler to build the attributed type when used as the return type of an async method.

AsyncStateMachineAttribute

Indicates whether a method is marked with either the Async or async modifier.

CallConvCdecl

Indicates that a method should use the Cdecl calling convention.

CallConvFastcall

This calling convention is not supported in this version of .NET.

CallConvMemberFunction

Indicates that the calling convention used is the member function variant.

CallConvStdcall

Indicates that a method should use the StdCall calling convention.

CallConvSuppressGCTransition

Indicates that a method should suppress the GC transition as part of the calling convention.

CallConvSwift
CallConvThiscall

Indicates that a method should use the ThisCall calling convention.

CallerArgumentExpressionAttribute

Indicates that a parameter captures the expression passed for another parameter as a string.

CallerFilePathAttribute

Allows you to obtain the full path of the source file that contains the caller. This is the file path at the time of compile.

CallerLineNumberAttribute

Allows you to obtain the line number in the source file at which the method is called.

CallerMemberNameAttribute

Allows you to obtain the method or property name of the caller to the method.

CallSite

A dynamic call site base class. This type is used as a parameter type to the dynamic site targets.

CallSite<T>

Dynamic site type.

CallSiteBinder

Class responsible for runtime binding of the dynamic operations on the dynamic call site.

CallSiteHelpers

Class that contains helper methods for DLR CallSites.

CallSiteOps

Creates and caches binding rules.

Closure

Represents the runtime state of a dynamically generated method.

CollectionBuilderAttribute
CompilationRelaxationsAttribute

Controls the strictness of the code generated by the common language runtime's just-in-time (JIT) compiler.

CompilerFeatureRequiredAttribute

Indicates that compiler support for a particular feature is required for the location where this attribute is applied.

CompilerGeneratedAttribute

Distinguishes a compiler-generated element from a user-generated element. This class cannot be inherited.

CompilerGlobalScopeAttribute

Indicates that a class should be treated as if it has global scope.

CompilerMarshalOverride

Indicates that the modified instance of a variable differs from its true type when marshaling. This class cannot be inherited.

ConditionalWeakTable<TKey,TValue>

Enables compilers to dynamically attach object fields to managed objects.

ContractHelper

Provides methods that the binary rewriter uses to handle contract failures.

CppInlineNamespaceAttribute

Defines the inline namespace in C++/CLI.

CreateNewOnMetadataUpdateAttribute

Indicates a type should be replaced rather than updated when applying metadata updates.

CustomConstantAttribute

Defines a constant value that a compiler can persist for a field or method parameter.

DateTimeConstantAttribute

Persists an 8-byte DateTime constant for a field or parameter.

DebugInfoGenerator

Generates debug information for lambda expressions in an expression tree.

DecimalConstantAttribute

Stores the value of a Decimal constant in metadata. This class cannot be inherited.

DefaultDependencyAttribute

Provides a hint to the common language runtime (CLR) indicating how likely a dependency is to be loaded. This class is used in a dependent assembly to indicate what hint should be used when the parent does not specify the DependencyAttribute attribute. This class cannot be inherited.

DependencyAttribute

Indicates when a dependency is to be loaded by the referring assembly. This class cannot be inherited.

DisablePrivateReflectionAttribute

Indicates that any private members contained in an assembly's types are not available to reflection.

DisableRuntimeMarshallingAttribute

Disables the built-in runtime managed/unmanaged marshalling subsystem for P/Invokes, Delegate types, and unmanaged function pointer invocations.

DiscardableAttribute

Marks a type definition as discardable.

DynamicAttribute

Indicates that the use of Object on a member is meant to be treated as a dynamically dispatched type.

EnumeratorCancellationAttribute

Allows users of async-enumerable methods to mark the parameter that should receive the cancellation token value from GetAsyncEnumerator(CancellationToken).

ExecutionScope

Represents the runtime state of a dynamically generated method.

ExtensionAttribute

Indicates that a method is an extension method, or that a class or assembly contains extension methods.

FixedAddressValueTypeAttribute

Fixes the address of a static value type field throughout its lifetime. This class cannot be inherited.

FixedBufferAttribute

Indicates that a field should be treated as containing a fixed number of elements of the specified primitive type. This class cannot be inherited.

FormattableStringFactory

Provides a static method to create a FormattableString object from a composite format string and its arguments.

HasCopySemanticsAttribute

This class is obsolete. This class cannot be inherited.

IDispatchConstantAttribute

Indicates that the default value for the attributed field or parameter is an instance of DispatchWrapper, where the WrappedObject is null.

IndexerNameAttribute

Indicates the name by which an indexer is known in programming languages that do not support indexers directly.

InlineArrayAttribute

Indicates that the instance's storage is sequentially replicated Length times.

InternalsVisibleToAttribute

Specifies that types that are ordinarily visible only within the current assembly are visible to a specified assembly.

InterpolatedStringHandlerArgumentAttribute

Indicates which arguments to a method involving an interpolated string handler should be passed to that handler.

InterpolatedStringHandlerAttribute

Indicates the attributed type is to be used as an interpolated string handler.

IsBoxed

Indicates that the modified reference type is a boxed value type. This class cannot be inherited.

IsByRefLikeAttribute

Indicates that a structure is byref-like.

IsByValue

Indicates that a modified method argument should be interpreted as having object passed-by-value semantics. This modifier is applied to reference types. This class cannot be inherited.

IsConst

Indicates that the modified type has a const modifier. This class cannot be inherited.

IsCopyConstructed

Indicates that any copying of values of this type must use the copy constructor provided by the type. This class cannot be inherited.

IsExplicitlyDereferenced

Indicates that a managed pointer represents a pointer parameter within a method signature. This class cannot be inherited.

IsExternalInit

Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code.

IsImplicitlyDereferenced

Indicates that the modified garbage collection reference represents a reference parameter within a method signature. This class cannot be inherited.

IsJitIntrinsic

Indicates that a modified method is an intrinsic value for which the just-in-time (JIT) compiler can perform special code generation. This class cannot be inherited.

IsLong

Indicates that a modified integer is a standard C++ long value. This class cannot be inherited.

IsPinned

Indicates that a modified instance is pinned in memory. This class cannot be inherited.

IsReadOnlyAttribute

Marks a program element as read-only.

IsSignUnspecifiedByte

Indicates that a modifier is neither signed nor unsigned. This class cannot be inherited.

IsUdtReturn

Indicates that a return type is a user-defined type. This class cannot be inherited.

IsUnmanagedAttribute

Reserved for use by a compiler for tracking metadata. This attribute should not be used by developers in source code.

IsVolatile

Marks a field as volatile. This class cannot be inherited.

IteratorStateMachineAttribute

Indicates whether a method in Visual Basic is marked with the Iterator modifier.

IUnknownConstantAttribute

Indicates that the default value for the attributed field or parameter is an instance of UnknownWrapper, where the WrappedObject is null. This class cannot be inherited.

MetadataUpdateOriginalTypeAttribute

Emitted by the compiler when a type that's marked with CreateNewOnMetadataUpdateAttribute is updated during a hot reload session.

MethodImplAttribute

Specifies the details of how a method is implemented. This class cannot be inherited.

ModuleInitializerAttribute

Used to indicate to the compiler that a method should be called in its containing module's initializer.

NativeCppClassAttribute

Applies metadata to an assembly that indicates that a type is an unmanaged type. This class cannot be inherited.

NullableAttribute

Reserved for use by a compiler for tracking metadata. This attribute should not be used by developers in source code.

NullableContextAttribute

Reserved for use by a compiler for tracking metadata. This attribute should not be used by developers in source code.

NullablePublicOnlyAttribute

Reserved for use by a compiler for tracking metadata. This attribute should not be used by developers in source code.

PreserveBaseOverridesAttribute

Ensures that any virtual call to the method, whether it uses the base signature or derived signature of the method, executes the most derived override.

ReadOnlyCollectionBuilder<T>

The builder for read only collection.

ReferenceAssemblyAttribute

Identifies an assembly as a reference assembly, which contains metadata but no executable code.

RefSafetyRulesAttribute

Indicates the language version of the ref safety rules used when the module was compiled.

RequiredAttributeAttribute

Specifies that an importing compiler must fully understand the semantics of a type definition, or refuse to use it. This class cannot be inherited.

RequiredMemberAttribute

Specifies that a type has required members or that a member is required.

RequiresLocationAttribute

Reserved for use by a compiler for tracking metadata. This attribute should not be used by developers in source code.

RuleCache<T>

Represents a cache of runtime binding rules.

RuntimeCompatibilityAttribute

Specifies whether to wrap exceptions that do not derive from the Exception class with a RuntimeWrappedException object. This class cannot be inherited.

RuntimeFeature

Defines APIs to determine whether specific features are supported by the common language runtime.

RuntimeHelpers

Provides a set of static methods and properties that provide support for compilers. This class cannot be inherited.

RuntimeOps

Contains helper methods called from dynamically generated methods.

RuntimeWrappedException

Wraps an exception that does not derive from the Exception class. This class cannot be inherited.

ScopedRefAttribute

Reserved for use by a compiler for tracking metadata. This attribute should not be used by developers in source code.

ScopelessEnumAttribute

Indicates that a native enumeration is not qualified by the enumeration type name. This class cannot be inherited.

SkipLocalsInitAttribute

Indicates to the compiler that the .locals init flag should not be set in nested method headers when emitting to metadata.

SpecialNameAttribute

Indicates that a type or member is treated in a special way by the runtime or tools. This class cannot be inherited.

StateMachineAttribute

Allows you to determine whether a method is a state machine method.

StringFreezingAttribute

Deprecated. Freezes a string literal when creating native images using the Ngen.exe (Native Image Generator). This class cannot be inherited.

StrongBox<T>

Holds a reference to a value.

SuppressIldasmAttribute

Prevents the Ildasm.exe (IL Disassembler) from disassembling an assembly. This class cannot be inherited.

SwitchExpressionException

Indicates that a switch expression that was non-exhaustive failed to match its input at runtime. The exception optionally contains an object representing the unmatched value.

TupleElementNamesAttribute

Indicates that the use of a value tuple on a member is meant to be treated as a tuple with element names.

TypeForwardedFromAttribute

Specifies a source Type in another assembly.

TypeForwardedToAttribute

Specifies a destination Type in another assembly.

Unsafe

Contains generic, low-level functionality for manipulating managed and unmanaged pointers.

UnsafeAccessorAttribute

Provides access to an inaccessible member of a specific type.

UnsafeValueTypeAttribute

Specifies that a type contains an unmanaged array that might potentially overflow. This class cannot be inherited.

Structs

AsyncIteratorMethodBuilder

Represents a builder for asynchronous iterators.

AsyncTaskMethodBuilder

Represents a builder for asynchronous methods that return a task.

AsyncTaskMethodBuilder<TResult>

Represents a builder for asynchronous methods that returns a task and provides a parameter for the result.

AsyncValueTaskMethodBuilder

Represents a builder for asynchronous methods that return a ValueTask.

AsyncValueTaskMethodBuilder<TResult>

Represents a builder for asynchronous methods that returns a ValueTask<TResult>.

AsyncVoidMethodBuilder

Represents a builder for asynchronous methods that do not return a value.

ConfiguredAsyncDisposable

Provides a type that can be used to configure how awaits on an IAsyncDisposable are performed.

ConfiguredCancelableAsyncEnumerable<T>.Enumerator

Provides an awaitable async enumerator that enables cancelable iteration and configured awaits.

ConfiguredCancelableAsyncEnumerable<T>

Provides an awaitable async enumerable that enables cancelable iteration and configured awaits.

ConfiguredTaskAwaitable

Provides an awaitable object that enables configured awaits on a task.

ConfiguredTaskAwaitable.ConfiguredTaskAwaiter

Provides an awaiter for an awaitable (ConfiguredTaskAwaitable) object.

ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter

Provides an awaiter for an awaitable object(ConfiguredTaskAwaitable<TResult>).

ConfiguredTaskAwaitable<TResult>

Provides an awaitable object that enables configured awaits on a task.

ConfiguredValueTaskAwaitable

Provides an awaitable type that enables configured awaits on a ValueTask.

ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter

Provides an awaiter for a ConfiguredValueTaskAwaitable.

ConfiguredValueTaskAwaitable<TResult>.ConfiguredValueTaskAwaiter

Provides an awaiter for a ConfiguredValueTaskAwaitable<TResult>.

ConfiguredValueTaskAwaitable<TResult>

Provides an awaitable type that enables configured awaits on a ValueTask<TResult>.

DefaultInterpolatedStringHandler

Provides a handler used by the language compiler to process interpolated strings into String instances.

PoolingAsyncValueTaskMethodBuilder

Represents a builder for asynchronous methods that return a ValueTask.

PoolingAsyncValueTaskMethodBuilder<TResult>

Represents a builder for asynchronous methods that returns a ValueTask<TResult>.

TaskAwaiter

Provides an object that waits for the completion of an asynchronous task.

TaskAwaiter<TResult>

Represents an object that waits for the completion of an asynchronous task and provides a parameter for the result.

ValueTaskAwaiter

Provides an awaiter for a ValueTask.

ValueTaskAwaiter<TResult>

Provides an awaiter for a ValueTask<TResult>.

YieldAwaitable

Provides the context for waiting when asynchronously switching into a target environment.

YieldAwaitable.YieldAwaiter

Provides an awaiter for switching into a target environment.

Interfaces

IAsyncStateMachine

Represents state machines that are generated for asynchronous methods. This type is intended for compiler use only.

ICriticalNotifyCompletion

Represents an awaiter that schedules continuations when an await operation completes.

INotifyCompletion

Represents an operation that schedules continuations when it completes.

IRuntimeVariables

Represents the values of run-time variables.

IStrongBox

Defines a property for accessing the value that an object references.

ITuple

Defines a general-purpose Tuple implementation that allows access to Tuple instance members without knowing the underlying Tuple type.

Enums

CompilationRelaxations

Specifies parameters that control the strictness of the code generated by the common language runtime's just-in-time (JIT) compiler.

LoadHint

Specifies the preferred default binding for a dependent assembly.

MethodCodeType

Defines how a method is implemented.

MethodImplOptions

Specifies constants that define the details of how a method is implemented.

UnsafeAccessorKind

Specifies the kind of target to which an UnsafeAccessorAttribute is providing access.

Delegates

ConditionalWeakTable<TKey,TValue>.CreateValueCallback

Represents a method that creates a non-default value to add as part of a key/value pair to a ConditionalWeakTable<TKey,TValue> object.

RuntimeHelpers.CleanupCode

Represents a method to run when an exception occurs.

RuntimeHelpers.TryCode

Represents a delegate to code that should be run in a try block.

Remarks

This namespace is primarily for compiler writers, although several of its classes, such as InternalsVisibleToAttribute, are used in a wide variety of applications.