Advertisement
vilgelmbb

Combine filename

Jun 16th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1.                             if (
  2.                                 Document.Files.Any(
  3.                                     i => i.FileName.Equals(fileData.Name, StringComparison.OrdinalIgnoreCase)))
  4.                             {
  5.                                 path = Path.Combine(Path.GetTempPath(),
  6.                                     Path.GetFileNameWithoutExtension(fileData.Name) + "_" + (new Random()).Next(1, 9) +
  7.                                     Path.GetExtension(fileData.Name));
  8.                             }
  9.                             else
  10.                             {
  11.                                 path = Path.Combine(Path.GetTempPath(), fileData.Name);
  12.                             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement