Creating temporary and random filenames

Just found a blog on how easy it was to generate temporary and/or random file-names using C# – thought I’d translate it into vb.net:

Imports System.IO

Private Function GetRandomJPGFileName() As String
   Return String.Format(“{0}.{1}”, Path.GetFileNameWithoutExtension(Path.GetRandomFileName).ToString, “jpg”)
End Function

Private Function GetTempJPGFileName() As String
   Return String.Format(“{0}.{1}”, Path.GetFileNameWithoutExtension(Path.GetTempFileName).ToString, “jpg”)
End Function

Leave a Comment