RuntimeHelpers Class
Provides a set of static methods and properties that provide support for compilers. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | OffsetToStringData | Gets the offset, in bytes, to the data in the given string. |
| Name | Description | |
|---|---|---|
![]() ![]() | EnsureSufficientExecutionStack() | Ensures that the remaining stack space is large enough to execute the average .NET Framework function. |
![]() ![]() | Equals(Object^, Object^) | Determines whether the specified Object instances are considered equal. |
![]() ![]() | ExecuteCodeWithGuaranteedCleanup(RuntimeHelpers::TryCode^, RuntimeHelpers::CleanupCode^, Object^) | |
![]() ![]() | GetHashCode(Object^) | Serves as a hash function for a particular object, and is suitable for use in algorithms and data structures that use hash codes, such as a hash table. |
![]() ![]() | GetObjectValue(Object^) | Boxes a value type. |
![]() ![]() | InitializeArray(Array^, RuntimeFieldHandle) | Provides a fast way to initialize an array from data that is stored in a module. |
![]() ![]() | PrepareConstrainedRegions() | Designates a body of code as a constrained execution region (CER). |
![]() ![]() | PrepareConstrainedRegionsNoOP() | Designates a body of code as a constrained execution region (CER) without performing any probing. |
![]() ![]() | PrepareContractedDelegate(Delegate^) | Provides a way for applications to dynamically prepare AppDomain event delegates. |
![]() ![]() | PrepareDelegate(Delegate^) | Indicates that the specified delegate should be prepared for inclusion in a constrained execution region (CER). |
![]() ![]() | PrepareMethod(RuntimeMethodHandle) | Prepares a method for inclusion in a constrained execution region (CER). |
![]() ![]() | PrepareMethod(RuntimeMethodHandle, array<RuntimeTypeHandle>^) | Prepares a method for inclusion in a constrained execution region (CER) with the specified instantiation. |
![]() ![]() | ProbeForSufficientStack() | Probes for a certain amount of stack space to ensure that a stack overflow cannot happen within a subsequent block of code (assuming that your code uses only a finite and moderate amount of stack space). We recommend that you use a constrained execution region (CER) instead of this method. |
![]() ![]() | RunClassConstructor(RuntimeTypeHandle) | Runs a specified class constructor method. |
![]() ![]() | RunModuleConstructor(ModuleHandle) | Runs a specified module constructor method. |
The following example shows how to reliably set handles by using the PrepareConstrainedRegions method. To reliably set a handle to a specified pre-existing handle, you must ensure that the allocation of the native handle and the subsequent recording of that handle within a SafeHandle object is atomic. Any failure between these operations (such as a thread abort or out-of-memory exception) will result in the native handle being leaked. You can use the PrepareConstrainedRegions method to make sure that the handle is not leaked.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
.jpeg?cs-save-lang=1&cs-lang=cpp)
.jpeg?cs-save-lang=1&cs-lang=cpp)
.jpeg?cs-save-lang=1&cs-lang=cpp)