Public Class MaiClass
Public Shared Sub Main
System.Console.WriteLine(WriteToTempFile("This is a test."))
End Sub
Public Shared Function WriteToTempFile(ByVal Data As String) As String
Dim strFilename As String = System.IO.Path.GetTempFileName()
Dim objFS As New System.IO.FileStream(strFilename, System.IO.FileMode.Append, System.IO.FileAccess.Write)
Dim Writer As New System.IO.StreamWriter(objFS)
Writer.BaseStream.Seek(0, System.IO.SeekOrigin.End)
Writer.WriteLine(Data)
Writer.Flush()
Writer.Close()
Return strFilename
End Function
End Class
|