I recursively detect all files in a directory using this apreach, which is fast.
In any case, I save the information in each file in the structure:
struct Info { public bool IsDirectory; public string Path; public FILETIME ModifiedDate; }
So now I am trying to decide that the weather places helper methods inside this structure or somewhere else for efficiency.
Helper Methods:
struct Info { public bool IsDirectory; public string Path; public FILETIME ModifiedDate;
I store thousands of files in memory, and I donβt know if using these methods inside Info will affect performance. In other words, it would be better to remove these methods and make them extension methods like:
public static class ExtensionHelperMethods { static public string GetFileName(this Info info){ } static public string GetFileSize(this Info info){ } static public string GetFileAtributes(this Info info) { }
So my question is , because Info is an instance structure, after which these methods internally lead to more memory? If Info is an instance structure, will each method have a different address in memory?
I tried using both methods and I do not see the differences. Maybe I need to try with a lot of files.
Edit
Here's to prove that @Fabio Gouw is right:
source share