C#: How would you make a unique filename by adding a number?

前端 未结 18 813
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 11:46

I would like to create a method which takes either a filename as a string or a FileInfo and adds an incremented number to the filename if the file

18条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 12:21

    If you need just a unique file name, so, how about this?

    Path.GetRandomFileName()
    

提交回复
热议问题