Skip to content

System.Runtime.CompilerServices.IsExternalInit

Assembly:
Not applicable / typically defined in your project or provided by the runtime. Often added as a small source file in projects that target older frameworks to enable C# 9+ init-only properties.

Namespace:
System.Runtime.CompilerServices

Type:
internal static class

Base:
System.Object

Summary:
An empty marker type used by the C# compiler to support init-only setters (the init accessor introduced in C# 9). Some target frameworks or runtimes do not include this type; adding this file to a project provides the required type so that code using init properties can compile and run on those runtimes. Keep the namespace and name exact: System.Runtime.CompilerServices.IsExternalInit. Be careful about assembly-level conflicts — only add this if the runtime / referenced assemblies do not already define it.


Fields

  • This type declares no fields.
    Add the type only to satisfy the compiler/runtime requirement; it intentionally contains no state.

Properties

  • This type declares no properties.

Constructors

  • This type has no instance constructors.
    It is declared as a static class, so it cannot be instantiated.

Methods

  • This type declares no methods.

Usage Example

Add this source file to your mod or project when targeting runtimes that lack IsExternalInit (so you can use init-only properties):

// System\Runtime\CompilerServices\IsExternalInit.cs
namespace System.Runtime.CompilerServices;

internal static class IsExternalInit
{
}

Notes and recommendations: - If you later reference a runtime or assembly that already defines IsExternalInit, you may encounter a type conflict. In that case remove this file. - Some projects use public instead of internal for this type; if you run into accessibility or linking issues, try changing the accessibility to match your environment. - This file is intentionally empty — its purpose is solely to provide the type token the compiler expects for init-only support.