What's The Equivalent Of C size_t In C#?

csharp
c-sharp
c-language

(isoftech) #1

Hi,

I am trying to add an unmanaged structure (defined already in C programming language) to my C# Application… And I came across this type called size_t :confused:

And I couldn’t find any equivalent of that type within C#, So what should I use to replace size_t?!

Thanks!


(afree) #2

hmm… size_t is a platform dependent type, So in some platforms It’s equivalent to uint while in others it’s equivalent to ulong.

But I believe as commonly known UIntPtr Is the .Net Framework Type that best fits with size_t. But there is no guarantee of that documented anywhere. as far as I know.