To find the name of a CSV file in C#, you can use the Path
class and its methods. One possible solution is to read in the full file path as a string and then split it using the Path.GetFileName()
method:
main.cs146 chars4 lines
This will output:
main.cs31 chars2 lines
Alternatively, you can use the Path.GetFileNameWithoutExtension()
method to get the filename without the extension:
main.cs143 chars3 lines
This will output:
main.cs45 chars2 lines
gistlibby LogSnag