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:\
I don't think there's a "trick"to get past using the brute force method to do this comparison, but you can optimize your solution somewhat:
Prepare: Find the shortest string Repeat: See if all of the other strings contain it If so, you're done If not, remove one or more characters