To find the name of a JSON file in C#, you can use the Directory.GetFiles()
method provided by the System.IO
namespace. The method takes two arguments, the path of the directory you want to search, and the file extension you want to filter the results by (in this case, .json
).
main.cs201 chars10 lines
This will print out the name of each JSON file in the directory specified by the path
variable. If you want to include the full path to the file, you can use the file
variable directly instead of Path.GetFileName(file)
.
gistlibby LogSnag