Это полезно?
KeysOverX () - вы можете портировать его, если хотите, так как мы не знаем требуемый язык:)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DictionaryQuestion
{
class Program
{
static void Main( string [] args ) {
// Define dictionary
Dictionary<int, string> dict = new Dictionary<int, string>();
dict.Add( 1, "lorum" );
dict.Add( 2, "ipsum" );
dict.Add( 3, "this" );
dict.Add( 4, "is" );
dict.Add( 5, "a" );
dict.Add( 6, "test" );
// Define
int startKey = 4;
var results = KeysOverX( dict, startKey );
foreach ( int k in results ) {
Console.WriteLine( k );
}
}
static IList<int> KeysOverX( Dictionary<int, string> dictionary, int lowestKey ) {
return (from item in dictionary
where item.Key > lowestKey
select item.Key).ToList<int>();
}
}
}