As we know C# 9 introduced us nint(native sized integers).
I read some documentation and I become bit confused. What is the need of them? And if they are useful does that mean int should be fully replaced by nint? because if nint is useful then it’s always better to use than classic int?(as I understood, I might be wrong)

The motivation is for interop scenarios and for low-level libraries.
Just like it says, interop scenarios and low-level libraries. For example, say you are writing code that works with a C library. That library has two versions, one using 32-bit integers and one using 64-bit integers.

Since C# can run as either 32-bit or 64-bit mode, you could end up using the 32-bit or 64-bit version of the library. Do you see where this is going?
Okay, got that and that make sense but what I don’t get is that what if I always use nint instead of int. It seems valid option because nint looks same as int but, it has aditionnally capability of dealing different bit modes
nint endo = 64;
Sorry, I couldn’t resist! 😁
take your upvote and get the hell out of here 😂
https://www.youtube.com/watch?v=pFlcqWQVVuU

You will likely never have a use for it, day to day work will be exactly as it is now (use int for 32bit int and long for 64bit int), it will only be useful when working with system int values.

Basically of you need it, you will know you need it.
It’s interesting that other languages take the opposite approach, such as Apple’s Swift, where “Int” is a native integer and you have “Int32” and “Int64”.

Of course, in C#, “nint” is just a C# feature, translating into either “System.Int32” or “System.Int64”.
They seem to be to IntPtr what int is to Int32
This right here. It’s a new type alias
I know there were proposals to add types like nint to .NET, but your link doesn’t show that; it points to Xamarin/Mono, which is a separate runtime.
Sorry, I had lot’s of tabs opened at that time and looks like I screwed up :D. Edited and fixed now

I don’t think it’s a runtime feature, just a C# shortcut.
That seems especially worthless. Either use int or use a known sized integral type as an ABI or protocol requires. If I need a performant int, i would expect to just use int. If we’re talking about marsaling code now then I think any performance gain is lost. For memory addresses there is IntPtr.

source