File stream Speed Question
alright so i want to make a program that takes all of the c# files in a directory, copies all of their content to that single file and trim the
using
statements25 Replies
note i haven't used filestream in c# before
anyways i want to which method would be faster for copying the content:
- copying all of the lines in one file to a single array/
List
, and doing that for each .cs file in the directory, or
- directly copying each line from the original file to the output file while i'm iterating through each file
i would assume the latter would be faster or both methods would be the same speedThat's one weird thing you're trying to do there, gotta say
it's for school since i can't run .net or anything on the chromebooks
and i want to use an online compiler
If I were to do concatenating files, I'd probably loop over them, read each individually, and keep appending them to a file
so read a line, append it to the file and repeat for each line of each file?
No
Read a file, append it to the end
mm so you can just copy the content of the whole file?
Sure
mm alright thanks
Also, you can install VS Code on a Chromebook, just gotta enable Linux layer
Alternatively, Github has free codespaces
linux is blocked
what is a codespace
A remote virtual machine with VS Code running in the browser connected to it
oh fuck yeah
it seems like it might work
so it would work with VS solutions then?
Alternatively, take it up with your school. If they require you to write good and proper C# on a Chromebook, they better make it work for you
Well, depends
Is it .NET Framework or .NET?
If the former, it's Windows-only
.NET i'm sure
yeah
If the latter, then yes
i don't even know the difference other than that .net framework is windows only
i'm doing c# for fun but i wish i knew
how to do that
@ZZZZZZZZZZZZZZZZZZZZZZZZZ also is it possible for a using statement to have a string in it
Wym?
it likely won't be a problem but just in case
using "this thing"
if not then i only have to parse it with consideration for comments
since the symbols can't have backslashesThat's not valid C#
ok good
all the valid situations where
using
worksalright thanks
wait so what would you use this for
and would this free
d
immediately after exiting the scope?
that would explain why you use it for filestreamWith the using statement, the resource is freed at the end of the scope
With the using block, at the end of the block
alright thanks