Let's say I have a class like:
public static class ListFilters
{
public static ulong FilesLargerThanValue { get; set; }
public static bool FilesLargerThan(FileData data)
{
return (data.Size >= ListFilters.FilesLargerThanValue);
}
}
and I want to call
ListFilters.FilesLargerThanValue = 1000000;
List<FileData> filteredList = pathScanner.AllFilesList.FindAll(ListFilters.FilesLargerThan);
My question is:
In.Net 2.0, would the code run faster if my ListFilters class is defined as static (and the predicate that goes to List.FindAll is static)?
See this , but I don't think you'll get any improvement. The code inside a static method will not run faster, but the call of a static method could be faster. And I don't think is that what you expect
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.