Problem with FileStream

Hi,
I have a problem with FileStream in Unity.
All the constructor are not recognize.

This one is not:
new FileStream(SafeFileHandle, FileAccess, Int32, Boolean)

Assets/ResourceScript/PipeServer.cs(240,99): error CS1502: The best overloaded method match for `System.IO.FileStream.FileStream(System.IntPtr, System.IO.FileAccess, bool, int)’ has some invalid arguments

Assets/ResourceScript/PipeServer.cs(240,99): error CS1503: Argument #1' cannot convert Microsoft.Win32.SafeHandles.SafeFileHandle’ expression to type `System.IntPtr’

I have a warning with:
new FileStream(IntPtr, FileAccess, Boolean, Int32)

Assets/ResourceScript/PipeServer.cs(238,120): warning CS0618: System.IO.FileStream.FileStream(System.IntPtr, System.IO.FileAccess, bool, int)' is obsolete: Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize) instead’

It works for a time and then I’m disconnected.

Is somebody already use FileStream with SafeFileHandle in a MonoBehaviour ?

Thanks.
Harold

According to the .Net/Mono Compatibility page the constructor you want is not avaliable using the .NET 2.0 subset, which is the default option. To change it go to Edit → Project settings → Player → Other settings → Api compatibility level.