עזרה קטנה ב LINQ
אני רוצה לבצע Group לרשימה ולבצע פעולת OR על Dictionary אבל אני מסתבך עם זה.
הנה הקוד:
אני רוצה לקבץ את כל ה Dics על ידי ה string.
איך אפשר לבצע את זה?
תודה רבה.
אני רוצה לבצע Group לרשימה ולבצע פעולת OR על Dictionary אבל אני מסתבך עם זה.
הנה הקוד:
קוד:
var myList = new List<MyClass>();
myList.Add(new MyClass { Str = "a", Values = new Dictionary<int, bool> { { 1, true }, { 4, false } } });
myList.Add(new MyClass { Str = "a", Values = new Dictionary<int, bool> { { 1, false }, { 4, false } } });
myList.Add(new MyClass { Str = "b", Values = new Dictionary<int, bool> { { 1, true }, { 4, true } } });
myList.Add(new MyClass { Str = "b", Values = new Dictionary<int, bool> { { 1, false }, { 4, false } } });
myList.Add(new MyClass { Str = "z", Values = new Dictionary<int, bool> { { 5, false }, { 9, false } } });
}
class MyClass
{
public string Str { get; set; }
public Dictionary<int, bool> Values { get; set; }
}
/*
a,1-true
4-false
b,1-true
4-true
z,5-false
9-true
*/
איך אפשר לבצע את זה?
תודה רבה.