Cluj München 1140km

Gânduri clujene din Bavaria

München - Munich - Monaco di Baviera

19. ianuarie 2009 13:41
by skorpionking
0 Comentarii

.NET 60 seconds code: creating and writing to temporary files with C#

19. ianuarie 2009 13:41 by skorpionking | 0 Comentarii

Here is how to create and use temporary files with C # (don't forget the try catch finalize):

                       string fileName = Path.GetTempFileName();
                        fileName = fileName.Replace(".tmp", ".rdp");

                        FileStream fileStream = null;
                        StreamWriter fileWriter = null;

                        fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write);
                        fileWriter = new StreamWriter(fileStream);
                         ...
                        fileWriter.Flush();
                        fileWriter.Close();

Adaugă comentariu

biuquote
Loading