Hypothetically the following situation:
you need to extract the log files from a huge number of folder structures and add them to the list.
Which scenario requires less resources from the machine?
LogFile file;
foreach (string filepath in folderfiles)
{
file = new LogFile { path = filepath,
machine = machineName,
user = userName };
files.Add(file);
}
or
foreach (string filepath in folderfiles)
{
LogFile logFile = new Logfile { path = filepath,
machine = machineName,
user = userName };
files.Add(file);
}
Doesn't that even matter?
source
share