Skip to content

System.Runtime.CompilerServices.IsUnmanagedAttribute

Assembly:
Defined in source (no specific assembly metadata in this file)

Namespace:
System.Runtime.CompilerServices

Type:
class (sealed)

Base:
System.Attribute

Summary:
An internal compiler/metadata attribute used to mark a type as "unmanaged". This class is marked with [CompilerGenerated] and [Microsoft.CodeAnalysis.Embedded], indicating it is intended for use by the compiler/tooling and can be embedded into assemblies by Roslyn. The attribute has no members and serves as a marker only. It is internal and sealed, so it is only usable within the defining assembly (or when embedded).


Fields

  • None
    This attribute declares no fields.

Properties

  • None
    This attribute declares no properties.

Constructors

  • internal IsUnmanagedAttribute()
    Default parameterless constructor (implicitly provided). Accessibility matches the class (internal).

Methods

  • None
    No methods are declared.

Remarks / Additional Info

  • Attributes applied to this attribute class:
  • [CompilerGenerated] — indicates the attribute was generated by a tool or compiler.
  • [Microsoft.CodeAnalysis.Embedded] — used by Roslyn to indicate the attribute should be embedded into compiled outputs when appropriate so consumers don't need a separate reference.
  • Because the class is internal, it is intended for use only within the assembly that defines it (or via embedding); it is not a public API.
  • The attribute name ends with "Attribute", so usage can be either [IsUnmanaged] or [IsUnmanagedAttribute].

Usage Example

// This example assumes the attribute is accessible (same assembly or embedded).
[IsUnmanaged]
internal struct MyUnmanagedStruct
{
    public int X;
    public float Y;
}