When would it be better to use nint over int?
03:40 08 Jan 2026

I've recently discovered that in C#9 a new types of nint and nuint were added.

I understand that they are native-sized integers, meaning they'll be 32 or 64 bits depending on the system their running on.

My question is when would it be more appropriate to use nint over int?

If you were only ever going to have Int32 then I would use int always (as using Int64 would be an unnecessary use of memory), but if you sometimes need Int64 would you need to guarantee this would only be needed on a 64-bit system?

c#