Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

nint: practical reference

nint: practical reference: nint is a signed integer whose width matches the native pointer size.

Version: C# built-in type reference; .NET 10 runtime

Syntax

nint value

nint is a signed integer whose width matches the native pointer size.

Use it in interop and architecture-dependent arithmetic.

Its 32- or 64-bit width changes range and serialization across platforms.

Its default is zero, while overflow and sizeof depend on the process architecture.

The complete program actually uses nint; its exact expected stdout is System.IntPtr.

Examples

using System;

Console.WriteLine(typeof(nint).FullName);

Result

System.IntPtr

The complete program actually uses `nint`; its exact expected stdout is `System.IntPtr`.

Sources