I would like to do something like the below. What function returns me an unique file that is opened? so i can ensure it is mine and i wont overwrite anything or write a comp
There are two methods for this:
Path.GetTempFileName
This will create a temporary file and return its name.
Path.GetRandomFileName
This will use a cryptographically strong, random string as file name and won't create the file for you.
Usually the first method suffices; the documentation for GetRandomFileName says:
When the security of your file system is paramount, this method should be used instead of GetTempFileName.