fork download
using System;
using System.Globalization;
using System.Linq;
using System.Collections.Generic;

public class Test
{
	public static void Main()
	{
    	    Dictionary<string, int> paths = new Dictionary<string, int>();
            paths.Add("/abc/12", 1);
            paths.Add("/test/abc", 2);
            paths.Add("/stack/overflow/com", 3);
            paths.Add("/stack/exception", 3);

            List<string> filter = new List<string>();
            filter.Add("/abc");
            filter.Add("/stack/overflow");

            var toDelete = paths
                .Where(kv => !filter.Any(f => kv.Key.StartsWith(f)));
            foreach (var delete in toDelete.Reverse())
                paths.Remove(delete.Key);

        foreach(var kv in paths)Console.WriteLine("{0} {1}",kv.Key,kv.Value);
    }
}
Success #stdin #stdout 0.07s 34096KB
stdin
Standard input is empty
stdout
/abc/12 1
/stack/overflow/com 3