2

Dictionary<int, string> buttonGroups 値が特定の文字列と一致する場所からアイテムを返す次のコードがあり ます。

    public static void RemoveColorRange(List<Button> buttons, int[] matches)
    {
        Dictionary<int, string> buttonGroups = new Dictionary<int, string>();

        foreach (Button btn in buttons)
        {                               
            if ((int)btn.Tag == matches[0] || (int)btn.Tag == matches[1])
                continue;

            SolidColorBrush brush = (SolidColorBrush)btn.Background;
            Color color = new Color();
            color = brush.Color;
            buttonGroups.Add((int)btn.Tag, closestColor(color));               
        }

        var buttonMatches = buttonGroups.Where(x => x.Value == 'somestring');
    }

ただし、辞書オブジェクトではなく、次の型を返します。buttonMatches から値を取得できないようです。私は何が欠けていますか?

{System.Linq.Enumerable.WhereEnumerableIterator<System.Collections.Generic.KeyValuePair<int,string>>}
4

1 に答える 1