c# - How to get from Dictionary<char, Tuple <int, char>> int value for specific key? -


i have 2 dictionaries in first case used tuple key values , works fine

dictionary<tuple<char, char>, int> pairpoints = new dictionary<tuple<char, char>, int>(); foreach (var items in this.pairpoints)    console.writeline(items.key.item1); 

but in second case want value in tuple {int,char} cant find result.values.item1

dictionary<char, tuple <int, char>> result = new dictionary<char, tuple<int, char>>(); if(distance < result.values.item1) {//do things} 

is possible write or have use different array method?

result.values collection of tuple<int, char> can access single item in collection dictionary key:

result[somechar].item1 

or can loop though values follows:

foreach(var tuple in result.values)     console.writeline(tuple.item1) 

Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -