Share via


System.Runtime namespaces

System.Runtime and its child namespaces (System.Runtime.CompilerServices, System.Runtime.ExceptionServices, System.Runtime.InteropServices, System.Runtime.InteropServices.ComTypes, System.Runtime.InteropServices.WindowsRuntime, System.Runtime.Serialization, System.Runtime.Serialization.Json, and System.Runtime.Versioning) contain types that support an application's interaction with the common language runtime, and types that enable features such as advanced exception handling, COM interop, serialization and deserialization, and versioning.

This topic displays the types in the System.Runtime namespaces that are included in the .NET for Windows Store apps. Note that the .NET for Windows Store apps does not include all the members of each type. For information about individual types, see the linked topics. The documentation for a type indicates which members are included in the .NET for Windows Store apps.

System.Runtime namespace

Types supported in the .NET for Windows Store apps

Description

GCLatencyMode

Adjusts the time that the garbage collector intrudes in your application.

GCSettings

Specifies the garbage collection settings for the current process.

System.Runtime.CompilerServices namespace

Types supported in the .NET for Windows Store apps

Description

AccessedThroughPropertyAttribute

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

AsyncStateMachineAttribute

Allows you to determine whether a method is marked with the Async (Visual Basic) or async (C# Reference) modifier.

AsyncTaskMethodBuilder

Represents a builder for asynchronous methods that return a task.

AsyncTaskMethodBuilder<TResult>

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

AsyncVoidMethodBuilder

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

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

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

CallSite<T>

Represents a dynamic site type.

CallSiteBinder

Handles the runtime binding of the dynamic operations on the dynamic call site.

CallSiteHelpers

Contains helper methods for DLR CallSites.

CompilationRelaxationsAttribute

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

CompilerGeneratedAttribute

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

ConditionalWeakTable<TKey, TValue>

Enables compilers to dynamically attach object fields to managed objects.

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<T, T> object.

ConfiguredTaskAwaitable

Provides an awaitable object that allows for configured awaits on Task.

ConfiguredTaskAwaitable.ConfiguredTaskAwaiter

Provides an awaiter for a ConfiguredTaskAwaitable.

ConfiguredTaskAwaitable<TResult>

Provides an awaitable object that allows for configured awaits on Task<T>.

ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter

Provides an awaiter for a ConfiguredTaskAwaitable<T>.

ContractHelper

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

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.

DecimalConstantAttribute

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

DynamicAttribute

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

ExtensionAttribute

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

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.

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.

IndexerNameAttribute

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

INotifyCompletion

Represents an operation that schedules continuations when it completes.

InternalsVisibleToAttribute

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

IStrongBox

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

IsVolatile

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

IteratorStateMachineAttribute

Allows you to determine whether a method in Visual Basic is marked with the Iterator modifier.

MethodImplAttribute

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

MethodImplOptions

Defines the details of how a method is implemented.

ReferenceAssemblyAttribute

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

RuntimeCompatibilityAttribute

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

RuntimeHelpers

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

StateMachineAttribute

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

StrongBox<T>

Holds a reference to a value.

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.

TypeForwardedFromAttribute

Specifies a source Type in another assembly.

TypeForwardedToAttribute

Specifies a destination Type in another assembly.

UnsafeValueTypeAttribute

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

YieldAwaitable

Provides an awaitable context for switching into a target environment.

YieldAwaitable.YieldAwaiter

Provides an awaiter for switching into a target environment.

System.Runtime.ExceptionServices namespace

Types supported in the .NET for Windows Store apps

Description

ExceptionDispatchInfo

Represents an exception whose state is captured at a certain point in code.

System.Runtime.InteropServices namespace

Types supported in the .NET for Windows Store apps

Description

ArrayWithOffset

Encapsulates an array and an offset within the specified array.

BestFitMappingAttribute

Controls whether Unicode characters are converted to the closest matching ANSI characters.

BStrWrapper

Marshals data of type VT_BSTR from managed to unmanaged code. This class cannot be inherited.

CallingConvention

Specifies the calling convention required to call methods implemented in unmanaged code.

CharSet

Dictates which character set marshaled strings should use.

ClassInterfaceAttribute

Indicates the type of class interface to be generated for a class exposed to COM, if an interface is generated at all.

ClassInterfaceType

Identifies the type of class interface that is generated for a class.

CoClassAttribute

Specifies the class identifier of a coclass imported from a type library.

ComAwareEventInfo

Permits late-bound registration of an event handler.

ComDefaultInterfaceAttribute

Specifies a default interface to expose to COM. This class cannot be inherited.

ComEventInterfaceAttribute

Identifies the source interface and the class that implements the methods of the event interface that is generated when a coclass is imported from a COM type library.

ComEventsHelper

Provides methods that enable .NET Framework delegates that handle events to be added and removed from COM objects.

COMException

The exception that is thrown when an unrecognized HRESULT is returned from a COM method call.

ComImportAttribute

Indicates that the attributed type was previously defined in COM.

ComInterfaceType

Identifies how to expose an interface to COM.

ComMemberType

Describes the type of a COM member.

ComSourceInterfacesAttribute

Identifies a list of interfaces that are exposed as COM event sources for the attributed class.

ComVisibleAttribute

Controls accessibility of an individual managed type or member, or of all types within an assembly, to COM.

CriticalHandle

Represents a wrapper class for handle resources.

CurrencyWrapper

Wraps objects the marshaler should marshal as a VT_CY.

CustomQueryInterfaceMode

Indicates whether the GetComInterfaceForObject method's IUnknown.QueryInterface calls can use the ICustomQueryInterface interface.

CustomQueryInterfaceResult

Provides return values for the GetInterface method.

DefaultCharSetAttribute

Specifies the value of the CharSet enumeration. This class cannot be inherited.

DefaultDllImportSearchPathsAttribute

Specifies the paths that are used to search for DLLs that provide functions for platform invokes.

DefaultParameterValueAttribute

Sets the default value of a parameter when called from a language that supports default parameters. This class cannot be inherited.

DispatchWrapper

Wraps objects the marshaler should marshal as a VT_DISPATCH.

DispIdAttribute

Specifies the COM dispatch identifier (DISPID) of a method, field, or property.

DllImportAttribute

Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point.

DllImportSearchPath

Specifies the paths that are used to search for DLLs that provide functions for platform invokes.

ErrorWrapper

Wraps objects the marshaler should marshal as a VT_ERROR.

FieldOffsetAttribute

Indicates the physical position of fields within the unmanaged representation of a class or structure.

GCHandle

Provides a way to access a managed object from unmanaged memory.

GCHandleType

Represents the types of handles the GCHandle class can allocate.

GuidAttribute

Supplies an explicit Guid when an automatic GUID is undesirable.

HandleCollector

Tracks outstanding handles and forces a garbage collection when the specified threshold is reached.

ICustomAdapter

Provides a way for clients to access the actual object, rather than the adapter object handed out by a custom marshaler.

ICustomQueryInterface

Enables developers to provide a custom, managed implementation of the IUnknown.QueryInterface method.

InAttribute

Indicates that data should be marshaled from the caller to the callee, but not back to the caller.

InterfaceTypeAttribute

Indicates whether a managed interface is dual, dispatch-only, or IUnknown -only when exposed to COM.

InvalidComObjectException

The exception thrown when an invalid COM object is used.

InvalidOleVariantTypeException

The exception thrown by the marshaler when it encounters an argument of a variant type that can not be marshaled to managed code.

LayoutKind

Controls the layout of an object when exported to unmanaged code.

Marshal

Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks, and converting managed to unmanaged types, as well as other miscellaneous methods used when interacting with unmanaged code.

MarshalAsAttribute

Indicates how to marshal the data between managed and unmanaged code.

MarshalDirectiveException

The exception that is thrown by the marshaler when it encounters a MarshalAsAttribute it does not support.

OptionalAttribute

Indicates that a parameter is optional.

OutAttribute

Indicates that data should be marshaled from callee back to caller.

PreserveSigAttribute

Indicates that the HRESULT or retval signature transformation that takes place during COM interop calls should be suppressed.

SafeArrayRankMismatchException

The exception thrown when the rank of an incoming SAFEARRAY does not match the rank specified in the managed signature.

SafeArrayTypeMismatchException

The exception thrown when the type of the incoming SAFEARRAY does not match the type specified in the managed signature.

SafeBuffer

Provides a controlled memory buffer that can be used for reading and writing. Attempts to access memory outside the controlled buffer (underruns and overruns) raise exceptions.

SafeHandle

Represents a wrapper class for operating system handles. This class must be inherited.

SEHException

Represents structured exception handling (SEH) errors.

StructLayoutAttribute

Lets you control the physical layout of the data fields of a class or structure.

TypeIdentifierAttribute

Provides support for type equivalence.

UnknownWrapper

Wraps objects the marshaler should marshal as a VT_UNKNOWN.

UnmanagedFunctionPointerAttribute

Controls the marshaling behavior of a delegate signature passed as an unmanaged function pointer to or from unmanaged code. This class cannot be inherited.

UnmanagedType

Identifies how to marshal parameters or fields to unmanaged code.

VarEnum

Indicates how to marshal the array elements when an array is marshaled from managed to unmanaged code as a SafeArray.

VariantWrapper

Marshals data of type VT_VARIANT | VT_BYREF from managed to unmanaged code. This class cannot be inherited.

System.Runtime.InteropServices.ComTypes namespace

Types supported in the .NET for Windows Store apps

Description

ADVF

Specifies the requested behavior when setting up an advise sink or a caching connection with an object.

BIND_OPTS

Stores the parameters that are used during a moniker binding operation.

BINDPTR

Contains a pointer to a bound-to FUNCDESC structure, VARDESC structure, or an ITypeComp interface.

CALLCONV

Identifies the calling convention used by a method described in a METHODDATA Data Type structure.

CONNECTDATA

Describes a connection that exists to a given connection point.

DATADIR

Specifies the direction of the data flow in the dwDirection parameter of the EnumFormatEtc method. This determines the formats that the resulting enumerator can enumerate.

DESCKIND

Identifies the type description being bound to.

DISPPARAMS

Contains the arguments passed to a method or property by IDispatch.Invoke.

DVASPECT

Specifies the desired data or view aspect of the object when drawing or getting data.

ELEMDESC

Contains the type description and process transfer information for a variable, function, or a function parameter.

ELEMDESC.DESCUNION

Contains information about an element.

EXCEPINFO

Describes the exceptions that occur during IDispatch.Invoke.

FILETIME

Represents the number of 100-nanosecond intervals since January 1, 1601. This structure is a 64-bit value.

FORMATETC

Represents a generalized Clipboard format.

FUNCDESC

Defines a function description.

FUNCFLAGS

Identifies the constants that define the properties of a function.

FUNCKIND

Defines how to access a function.

IAdviseSink

Provides a managed definition of the IAdviseSink interface.

IBindCtx

Provides the managed definition of the IBindCtx interface.

IConnectionPoint

Provides the managed definition of the IConnectionPoint interface.

IConnectionPointContainer

Provides the managed definition of the IConnectionPointContainer interface.

IDLDESC

Contains information needed for transferring a structure element, parameter, or function return value between processes.

IDLFLAG

Describes how to transfer a structure element, parameter, or function return value between processes.

IEnumConnectionPoints

Manages the definition of the IEnumConnectionPoints interface.

IEnumConnections

Manages the definition of the IEnumConnections interface.

IEnumFORMATETC

Provides the managed definition of the IEnumFORMATETC interface.

IEnumMoniker

Manages the definition of the IEnumMoniker interface.

IEnumString

Manages the definition of the IEnumString interface.

IEnumVARIANT

Manages the definition of the IEnumVARIANT interface.

IMoniker

Provides the managed definition of the IMoniker interface, with COM functionality from IPersist and IPersistStream.

IMPLTYPEFLAGS

Defines the attributes of an implemented or inherited interface of a type.

INVOKEKIND

Specifies how to invoke a function by IDispatch.Invoke.

IPersistFile

Provides the managed definition of the IPersistFile interface, with functionality from IPersist.

IRunningObjectTable

Provides the managed definition of the IRunningObjectTable interface.

IStream

Provides the managed definition of the IStream interface, with ISequentialStream functionality.

ITypeComp

Provides the managed definition of the ITypeComp interface.

ITypeInfo

Provides the managed definition of the Component Automation ITypeInfo interface.

ITypeInfo2

Provides the managed definition of the ITypeInfo2 interface.

ITypeLib

Provides the managed definition of the ITypeLib interface.

ITypeLib2

Provides a managed definition of the ITypeLib2 interface.

LIBFLAGS

Defines flags that apply to type libraries.

PARAMDESC

Contains information about how to transfer a structure element, parameter, or function return value between processes.

PARAMFLAG

Describes how to transfer a structure element, parameter, or function return value between processes.

STATDATA

Provides the managed definition of the STATDATA structure.

STATSTG

Contains statistical information about an open storage, stream, or byte-array object.

STGMEDIUM

Provides the managed definition of the STGMEDIUM structure.

SYSKIND

Identifies the target operating system platform.

TYMED

Provides the managed definition of the TYMED structure.

TYPEATTR

Contains attributes of a UCOMITypeInfo.

TYPEDESC

Describes the type of a variable, return type of a function, or the type of a function parameter.

TYPEFLAGS

Defines the properties and attributes of a type description.

TYPEKIND

Specifies various types of data and functions.

TYPELIBATTR

Identifies a particular type library and provides localization support for member names.

VARDESC

Describes a variable, constant, or data member.

VARDESC.DESCUNION

Contains information about a variable.

VARFLAGS

Identifies the constants that define the properties of a variable.

VARKIND

Defines the kind of variable.

System.Runtime.InteropServices.WindowsRuntime namespace

Types supported in the .NET for Windows Store apps

Description

AsyncInfo

Provides factory methods to construct representations of managed tasks that are compatible with Windows Runtime asynchronous actions and operations.

DefaultInterfaceAttribute

Specifies the default interface of a managed Windows Runtime class or interface group.

EventRegistrationToken

A token that is returned when an event handler is added to a Windows Runtime event that is implemented in managed code. The token is used to remove the event handler from the event at a later time.

EventRegistrationTokenTable<T>

Stores mappings between delegates and event tokens, to support the implementation of a Windows Runtime event in managed code.

IActivationFactory

Enables classes to be activated by the Windows Runtime.

InterfaceImplementedInVersionAttribute

Specifies the version of the target type that first implemented the specified interface.

ReadOnlyArrayAttribute

When applied to an array parameter in a Windows Runtime component, specifies that the contents of the array that is passed to that parameter are used only for input. The caller expects the array to be unchanged by the call.

ReturnValueNameAttribute

Specifies the name of the return value of a method in a Windows Runtime component.

WindowsRuntimeBuffer

Provides an implementation of the Windows Runtime IBuffer interface (Windows.Storage.Streams.IBuffer), and all additional required interfaces.

WindowsRuntimeBufferExtensions

Provides extension methods for operating on Windows Runtime buffers (Windows.Storage.Streams.IBuffer interface).

WindowsRuntimeMarshal

Provides helper methods for marshaling data between the .NET Framework and the Windows Runtime.

WriteOnlyArrayAttribute

When applied to an array parameter in a Windows Runtime component, specifies that the contents of an array that is passed to that parameter are used only for output. The caller does not guarantee that the contents are initialized, and the called method should not read the contents.

System.Runtime.Serialization namespace

Types supported in the .NET for Windows Store apps

Description

CollectionDataContractAttribute

When applied to a collection type, enables custom specification of the collection item elements. This attribute can be applied only to types that are recognized by the DataContractSerializer as valid, serializable collections.

ContractNamespaceAttribute

Specifies the CLR namespace and XML namespace of the data contract.

DataContractAttribute

Specifies that the type defines or implements a data contract and is serializable by a serializer, such as the DataContractSerializer. To make their type serializable, type authors must define a data contract for their type.

DataContractResolver

Provides a mechanism for dynamically mapping types to and from xsi:type representations during serialization and deserialization.

DataContractSerializer

Serializes and deserializes an instance of a type into an XML stream or document using a supplied data contract. This class cannot be inherited.

DataContractSerializerSettings

Specifies data contract serializer settings.

DataMemberAttribute

When applied to the member of a type, specifies that the member is part of a data contract and is serializable by the DataContractSerializer.

DateTimeFormat

Specifies date-time format options.

EmitTypeInformation

Specifies how often to emit type information.

EnumMemberAttribute

Specifies that the field is an enumeration member and should be serialized.

IgnoreDataMemberAttribute

When applied to the member of a type, specifies that the member is not part of a data contract and is not serialized.

InvalidDataContractException

The exception that is thrown when the DataContractSerializer or NetDataContractSerializer encounters an invalid data contract during serialization and deserialization.

KnownTypeAttribute

Specifies types that should be recognized by the DataContractSerializer when serializing or deserializing a given type.

OnDeserializedAttribute

When applied to a method, specifies that the method is called immediately after deserialization of an object in an object graph. The order of deserialization relative to other objects in the graph is non-deterministic.

OnDeserializingAttribute

When applied to a method, specifies that the method is called during deserialization of an object in an object graph. The order of deserialization relative to other objects in the graph is non-deterministic.

OnSerializedAttribute

When applied to a method, specifies that the method is called after serialization of an object in an object graph. The order of serialization relative to other objects in the graph is non-deterministic.

OnSerializingAttribute

When applied to a method, specifies that the method is during serialization of an object in an object graph. The order of serialization relative to other objects in the graph is non-deterministic.

SerializationException

The exception thrown when an error occurs during serialization or deserialization.

StreamingContext

Describes the source and destination of a given serialized stream, and provides an additional caller-defined context.

XmlObjectSerializer

Provides the base class used to serialize objects as XML streams or documents. This class is abstract.

System.Runtime.Serialization.Json namespace

Types supported in the .NET for Windows Store apps

Description

DataContractJsonSerializer

Serializes objects to the JavaScript Object Notation (JSON) and deserializes JSON data to objects. This class cannot be inherited.

DataContractJsonSerializerSettings

Specifies settings.

System.Runtime.Versioning namespace

Types supported in the .NET for Windows Store appsClass

Description

TargetFrameworkAttribute

Identifies the version of the .NET Framework that a particular assembly was compiled against.

See Also

Concepts

.NET for Windows Store apps APIs