Hello everyone,
Two questions about IntPtr,
http://msdn2.microsoft.com/en-us/library/system.intptr(VS.80).aspx
1. does it mean in the internal SDK API implementation System.IO.FileStream, IntPtr is used to hold the native file handle?
2. when do we need to use IntPtr? We have easy to use class like StreamWriter, when and why do we need to use IntPtr?
thanks in advance,
George
George GeorgePosted Apr 19, 2008, 9:18 AM
Cool, Alan!
regards,
George
AlanPosted Apr 19, 2008, 8:57 AM
Yes, an IntPtr is to used to hold a native file handle in the FileStream class. It's also used to hold native window handles - for example the Control class has a Handle property which returns an IntPtr.
IntPtrs are also used extensively when interoperating with unmanaged code such as when calling unmanaged functions using P/Invoke (DllImport).