Meistro
❔ Random take a File from a Folder
Hello Dear CSharp Programmers
I have a Question, lets say I have a folder with 1_000 Files. From this folder I would like to randomly pick 1_00. But every file should be taken only once.
How would this method look like ?
I tryed it by myself but it always take one file more then once.
my Code:
I wanted to also store all ever picked Files and always check if the newly picked random file has already used once or not but I couldnt manage to code it.
thank you for every help
19 replies
Random pick a file from a given Folder
Hello Dear CSharp Programmers
I have a Question, lets say I have a folder with 1_000 Files. From this folder I would like to randomly pick 1_00. But every file should be taken only once.
How would this method look like ?
I tryed it by myself but it always take one file more then once.
my Code:
I wanted to also store all ever picked Files and always check if the newly picked random file has already used once or not but I couldnt manage to code it.
thank you for every help
1 replies
❔ multithreading with Tasks
I have a question about C# multithreading or async methods. I'm currently trying to upload multiple files to a server via an API (with login data, etc.).
My problem is that while waiting for all the tasks to complete, I want to query how many tasks have already finished, as long as the tasks are not yet completed.
Specifically, I am uploading 30k files. Each file is started as a task. While the tasks are running, a loop should run during the await (await Task.WhenAll(uploadTasks);) to check how many tasks have already completed, and every 10k files, there should be a message like "Hey, I have uploaded 10k files and it's still running."
it is working by the way ...but I am not sure whether it is realy counting while awating or not.
127 replies
Newtonsoft.Json.JsonReaderException: "Unexpected character encountered while parsing value: <. Path
Hei all, I am coding a REST API HTTP POST REQUEST, but I always get an error as soon as I start Building the Project. Might it be the way how my JSON is written ? or maybe something else ?
the code:
Thanks in advance for any help 🙂
24 replies
System.UnauthorizedAccessException [Answered]
Hei I need help with this line
I want to search for a specific Folder in my Drive "C:\"
But it always give me access denie for C:$Recycle.Bin. I want to skip it but it doesnt work even with try cath.
Thanks for any help
15 replies
denied accessing path string[] list1 = Directory.GetFiles(C_Drive, *.exe, SearchOption.AllDirectorie
Hei all,
I am not able to iterate through my drive ... is it a security problem ? I already opened VS as Admin
ERROR Message:
Thanks in Advance for any Help 🙂
7 replies
Hei all, I am new to this Server and I realy need help on specific Problem [Answered]
I am trying to move a .csv File from a Folder to another and it is actualy working but when I open the transfered File and compare it with the original one, the new File seem to be completly different. It is broken. There are new Characters in the new file which are not existing in the Origin one.
Thanks in advance
102 replies