What is the best way extract the common file path from the list of file path strings in c#?
Eg: I have a list 5 file paths in List variable, like below
c:\
The selected solution does not work properly if one of the paths is exactly the directory name that should be returned. I think there should be:
from len in Enumerable.Range(0, matchingNames.Min(s => s.Length) + 1).Reverse()