子列表中条件的C#Lambda表达式

时间:2018-07-29 11:10:56

标签: c# lambda

我知道有很多类似的问题,但是我无法解决。

我有课

class A {
public Guid Id {get; set}
}

class B {
public IEnumerable<A> a {get; set;}
}

var myMethod(guid guid)
{
    //there a filled in my data and try to select
    var Z= B.Where(arg=>arg.A.All(args=>args.Id == guid));
}

我需要从B中选择所有A个条件,但我的z始终没有任何元素。 我在哪里弄错了?

已更新 测试JSON数据:

{      
  "ChainImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531475236/ChainImages/Originals/69738688-9414-4f34-86a1-bc882bf7ae83.png",
  "ChainImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531475236/ChainImages/Originals/69738688-9414-4f34-86a1-bc882bf7ae83.png",
  "Promotions": [
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "2,00 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532418043/ProductImages/Originals/dac52a2b-1bf3-4643-9c84-510234646e79.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532418045/ProductImages/300x300/d70009b3-3d72-4853-9a88-fdd27e506da2.png",
      "Id": "139c7498-7f7c-446e-4106-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 2.60,
      "NewPrice": 2.00,
      "DiscountPercent": 23.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "fb524f53-8754-4e78-8947-455648dd828c",
      "Name": "Груша",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532418043/ProductImages/Originals/dac52a2b-1bf3-4643-9c84-510234646e79.jpg",
        "Width": 500,
        "Height": 341
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532418045/ProductImages/300x300/d70009b3-3d72-4853-9a88-fdd27e506da2.png",
          "Width": 300,
          "Height": 204
        }
      ],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "NewPricePerUnit": 2.0,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "2,10 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417829/ProductImages/Originals/fa200848-c9d9-4435-a3fe-6efec0ce7a36.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417830/ProductImages/300x300/89544f79-75b7-4d66-9395-30ea66225cca.png",
      "Id": "1cc3288b-7775-45f4-4103-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 2.60,
      "NewPrice": 2.10,
      "DiscountPercent": 19.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "fb524f53-8754-4e78-8947-455648dd828c",
      "Name": "Киви",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417829/ProductImages/Originals/fa200848-c9d9-4435-a3fe-6efec0ce7a36.jpg",
        "Width": 350,
        "Height": 237
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417830/ProductImages/300x300/89544f79-75b7-4d66-9395-30ea66225cca.png",
          "Width": 300,
          "Height": 203
        }
      ],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "NewPricePerUnit": 2.1,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "2,00 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417552/ProductImages/600x600/f8859077-f154-489c-ae80-f137990275b7.png",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417553/ProductImages/300x300/4e4c832c-a63e-4310-8654-6949b9febff7.png",
      "Id": "31ef77db-1269-4fe8-4100-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 2.40,
      "NewPrice": 2.00,
      "DiscountPercent": 17.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "fb524f53-8754-4e78-8947-455648dd828c",
      "Name": "Банан",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417549/ProductImages/Originals/aca79ac5-213f-4f31-940a-9b8a32bc32bb.jpg",
        "Width": 1000,
        "Height": 1020
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417553/ProductImages/300x300/4e4c832c-a63e-4310-8654-6949b9febff7.png",
          "Width": 294,
          "Height": 300
        },
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417552/ProductImages/600x600/f8859077-f154-489c-ae80-f137990275b7.png",
          "Width": 588,
          "Height": 600
        }
      ],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "NewPricePerUnit": 2.0,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": " руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532423292/ProductImages/Originals/b4e44e8d-ce13-496d-9d4b-d1a1f7a923b6.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532423292/ProductImages/Originals/b4e44e8d-ce13-496d-9d4b-d1a1f7a923b6.jpg",
      "Id": "565cd6a6-6345-4645-40f8-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "DiscountPercent": 30.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "208174a0-fdff-413c-a882-2fb162270646",
      "Name": "Помидор",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532423292/ProductImages/Originals/b4e44e8d-ce13-496d-9d4b-d1a1f7a923b6.jpg",
        "Width": 220,
        "Height": 189
      },
      "OtherImageDimensions": [],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": " руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532416886/ProductImages/Originals/46f67abb-5a22-4767-8048-e3ea66488a2b.png",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532416886/ProductImages/Originals/46f67abb-5a22-4767-8048-e3ea66488a2b.png",
      "Id": "5790337c-5433-4ff5-40fe-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "DiscountPercent": 50.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "208174a0-fdff-413c-a882-2fb162270646",
      "Name": "Кукуруза",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532416886/ProductImages/Originals/46f67abb-5a22-4767-8048-e3ea66488a2b.png",
        "Width": 254,
        "Height": 222
      },
      "OtherImageDimensions": [],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": " руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417216/ProductImages/Originals/72d071ec-0d27-4361-b825-2432b940ea70.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417218/ProductImages/300x300/9ad0f5d4-5069-4ed0-9dda-7b4642e1a29c.png",
      "Id": "7b7a566f-cf21-43f1-40ff-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "DiscountPercent": 30.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "fb524f53-8754-4e78-8947-455648dd828c",
      "Name": "Абрикос",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417216/ProductImages/Originals/72d071ec-0d27-4361-b825-2432b940ea70.jpg",
        "Width": 400,
        "Height": 400
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532417218/ProductImages/300x300/9ad0f5d4-5069-4ed0-9dda-7b4642e1a29c.png",
          "Width": 300,
          "Height": 300
        }
      ],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "930 мл",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "1,14 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532247185/ProductImages/600x600/11b70def-4683-47d0-a6c4-3e00fcef1a8e.png",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532247187/ProductImages/300x300/bb3e6104-2f3e-4086-9ffb-a787f1bea0b9.png",
      "Id": "8026b7db-8bdc-45d9-5a84-08d5ee3ccc18",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 1.39,
      "NewPrice": 1.14,
      "DiscountPercent": 34.00,
      "ValidFrom": "2018-07-23T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "53ec70a4-8955-4de0-af73-b31e06dca578",
      "SubCategoryId": "af64936e-4694-4a2e-b90b-1132588e2e0e",
      "Name": "Молоко «Молочные горки» 2%",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532247184/ProductImages/Originals/2f1568c8-719a-4c8f-9b23-91f8e8344170.jpg",
        "Width": 1000,
        "Height": 1000
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532247185/ProductImages/600x600/11b70def-4683-47d0-a6c4-3e00fcef1a8e.png",
          "Width": 600,
          "Height": 600
        },
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532247187/ProductImages/300x300/bb3e6104-2f3e-4086-9ffb-a787f1bea0b9.png",
          "Width": 300,
          "Height": 300
        }
      ],
      "Quantity": 930.00,
      "UnitMeasure": 4,
      "NewPricePerUnit": 1.2258064516129032258064516129,
      "ConvertedUnitMeasure": 5
    },
    {
      "MeasuredQuantity": "1 шт",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "1,50 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531829545/ProductImages/Originals/af0c329a-78de-4f24-b649-88046e59795d.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531829545/ProductImages/Originals/af0c329a-78de-4f24-b649-88046e59795d.jpg",
      "Id": "aad45235-a44e-44e4-4128-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 2.60,
      "NewPrice": 1.50,
      "DiscountPercent": 42.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "53ec70a4-8955-4de0-af73-b31e06dca578",
      "SubCategoryId": "503b2f7d-bb1d-43e7-9c09-daa9bf61e92d",
      "Name": "Творог",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531829545/ProductImages/Originals/af0c329a-78de-4f24-b649-88046e59795d.jpg",
        "Width": 300,
        "Height": 300
      },
      "OtherImageDimensions": [],
      "Quantity": 1.00,
      "UnitMeasure": 1,
      "NewPricePerUnit": 1.5,
      "ConvertedUnitMeasure": 1
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": " руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532423292/ProductImages/Originals/b4e44e8d-ce13-496d-9d4b-d1a1f7a923b6.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532423292/ProductImages/Originals/b4e44e8d-ce13-496d-9d4b-d1a1f7a923b6.jpg",
      "Id": "ac56d420-0703-4ad4-4115-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "DiscountPercent": 30.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "208174a0-fdff-413c-a882-2fb162270646",
      "Name": "Помидор",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532423292/ProductImages/Originals/b4e44e8d-ce13-496d-9d4b-d1a1f7a923b6.jpg",
        "Width": 220,
        "Height": 189
      },
      "OtherImageDimensions": [],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "400 г",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "0,99 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532435111/ProductImages/Originals/7ea677be-0808-4206-a332-2739126ffd3a.png",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532435111/ProductImages/Originals/7ea677be-0808-4206-a332-2739126ffd3a.png",
      "Id": "cbe28b66-33cd-46ef-4129-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 2.50,
      "NewPrice": 0.99,
      "DiscountPercent": 60.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "0e160905-032f-4712-8a12-72bd7a7e02ae",
      "SubCategoryId": "13699f06-cc01-4788-911f-83b9fd94724a",
      "Name": "Макароны Макфа",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532435111/ProductImages/Originals/7ea677be-0808-4206-a332-2739126ffd3a.png",
        "Width": 246,
        "Height": 233
      },
      "OtherImageDimensions": [],
      "Quantity": 400.00,
      "UnitMeasure": 2,
      "NewPricePerUnit": 2.475,
      "ConvertedUnitMeasure": 3
    },
    {
      "MeasuredQuantity": "1 л",
      "DaysCount": 2,
      "DaysCountBeforeEndFull": "2 дня",
      "NewPriceFull": "1,00 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532445930/ProductImages/600x600/8a51de2b-d3ff-4224-9a22-94a308597bbb.png",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532445932/ProductImages/300x300/3be987eb-ed26-4669-b818-3fc5d68a996e.png",
      "Id": "eb294eda-dfe2-4e2f-f053-08d5f19cfec7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 1.20,
      "NewPrice": 1.00,
      "DiscountPercent": 17.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-07-31T00:00:00+03:00",
      "CategoryId": "53ec70a4-8955-4de0-af73-b31e06dca578",
      "SubCategoryId": "af64936e-4694-4a2e-b90b-1132588e2e0e",
      "Name": "Молоко 1% вкусное",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532445928/ProductImages/Originals/d3e465da-23c0-47f8-bad5-eb9f50631661.jpg",
        "Width": 1365,
        "Height": 1365
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532445930/ProductImages/600x600/8a51de2b-d3ff-4224-9a22-94a308597bbb.png",
          "Width": 600,
          "Height": 600
        },
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532445932/ProductImages/300x300/3be987eb-ed26-4669-b818-3fc5d68a996e.png",
          "Width": 300,
          "Height": 300
        }
      ],
      "Quantity": 1.00,
      "UnitMeasure": 5,
      "NewPricePerUnit": 1.0,
      "ConvertedUnitMeasure": 5
    },
    {
      "MeasuredQuantity": "1 кг",
      "DaysCount": 6,
      "DaysCountBeforeEndFull": "6 дней",
      "NewPriceFull": "3,99 руб.",
      "PromotionImage600": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532422320/ProductImages/Originals/d80c59bd-9729-441d-928b-cccc936ed814.jpg",
      "PromotionImage300": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532422322/ProductImages/300x300/e69b2b25-1eb4-4abd-888e-405e36674e6d.png",
      "Id": "fdc994f0-0e98-4d1a-4112-08d5f134d7f7",
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "OldPrice": 5.43,
      "NewPrice": 3.99,
      "DiscountPercent": 27.00,
      "ValidFrom": "2018-07-24T00:00:00+03:00",
      "ValidTo": "2018-08-04T00:00:00+03:00",
      "CategoryId": "34e2cce9-f72a-4b68-83ab-20d99251e6ae",
      "SubCategoryId": "fb524f53-8754-4e78-8947-455648dd828c",
      "Name": "Слива",
      "OriginalImage": {
        "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532422320/ProductImages/Originals/d80c59bd-9729-441d-928b-cccc936ed814.jpg",
        "Width": 500,
        "Height": 500
      },
      "OtherImageDimensions": [
        {
          "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1532422322/ProductImages/300x300/e69b2b25-1eb4-4abd-888e-405e36674e6d.png",
          "Width": 300,
          "Height": 300
        }
      ],
      "Quantity": 1.00,
      "UnitMeasure": 3,
      "NewPricePerUnit": 3.99,
      "ConvertedUnitMeasure": 3
    }
  ],
  "Stores": [
    {
      "Id": "0e7dd149-728a-4d87-0ba1-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: круглосуточно",
      "AddressLine": "ул. Кальварийская, 4",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 323 52 54",
      "Latitude": 53.905955000,
      "Longitude": 27.539185000
    },
    {
      "Id": "16dc1516-0533-4c5c-0b9f-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: круглосуточно",
      "AddressLine": "Логойский тракт, 37",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 261 03 41",
      "Latitude": 53.955601000,
      "Longitude": 27.620141000
    },
    {
      "Id": "45eb8552-d526-45c7-0b9e-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: 08.00 до 23.00",
      "AddressLine": "ул. Белинского, 17/1",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 399 21 55",
      "Latitude": 53.935527000,
      "Longitude": 27.600746000
    },
    {
      "Id": "572ba839-d13b-41dc-0b9b-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: с 08.00 до 24.00",
      "AddressLine": "пересечение Логойский тракт и МКАД",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 237 93 33",
      "Latitude": 53.968963219,
      "Longitude": 27.547331853
    },
    {
      "Id": "59b1c148-f3e0-491f-0b9c-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: с 09.00 до 23.00",
      "AddressLine": "ул. Налибокская, 1",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 278 55 45",
      "Latitude": 53.926483000,
      "Longitude": 27.440172000
    },
    {
      "Id": "8e78f4e3-5187-4f52-0b9d-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: круглосуточно",
      "AddressLine": "пр-т Машерова, 76А",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 319-21-99",
      "Latitude": 53.913131000,
      "Longitude": 27.534244000
    },
    {
      "Id": "a6ce99a8-dfe0-4328-12e4-08d5ee459a12",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 9,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "AddressLine": "гикало 22",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "Latitude": 53.911794000,
      "Longitude": 27.592895000
    },
    {
      "Id": "c6a9e5be-5d79-433d-0ba0-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: 09.00 до 23.00",
      "AddressLine": "пр-т Жукова, 44",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 300 99 14",
      "Latitude": 53.876890569,
      "Longitude": 27.517391914
    },
    {
      "Id": "f028bc1b-a09f-477f-0ba2-08d5e72cc07e",
      "Name": "BIGZZ",
      "OpenedFrom": 480,
      "ClosedFrom": 1320,
      "Groups": 0,
      "ChainId": "270a3df5-d181-4258-0306-08d5e0260bca",
      "Notes": "Время работы: 08.00 до 23.00",
      "AddressLine": "ул. Жудро, 35/1",
      "CityId": "c10df524-dd14-4182-83b6-39f052a2856b",
      "MainPhone": "+375 (17) 365 29 17",
      "Latitude": 53.917321000,
      "Longitude": 27.478881000
    }
  ],
  "PromotionsCount": 12,
  "StoresCount": 9,
  "IsFavourite": false,
  "Id": "270a3df5-d181-4258-0306-08d5e0260bca",
  "Name": "BIGZZ",
  "OriginalImage": {
    "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531475236/ChainImages/Originals/69738688-9414-4f34-86a1-bc882bf7ae83.png",
    "Width": 260,
    "Height": 138
  },
  "OtherImageDimensions": [
    {
      "Url": "https://res.cloudinary.com/dgrc4fjsn/image/upload/v1531475239/ChainImages/100x100/74a2c897-7812-4d20-9c11-8935506de35c.png",
      "Width": 100,
      "Height": 53
    }
  ],
  "Website": "http://www.bigzz.by",
  "Notes": "http://www.bigzz.by/offers_news/discounts/"
}

我想选择Promotion等于SubCategoryId的所有af64936e-4694-4a2e-b90b-1132588e2e0e 我试着做 a.Where(arg => arg.Promotions.Any(args => args.SubCategoryId.Value == SubCategoryId)) a的对象列表。

2 个答案:

答案 0 :(得分:1)

您可以使用Where函数按SubCategoryId过滤促销活动,然后根据过滤结果更新促销活动集合。

List<YourItemType> allItems = JsonConvert.DeserializeObject<YoutItemType>(rawJson);

allItems.ForEach(item => 
{
     item.Promotions = item.Promotions.Where(p => p.SubCategoryId = givenId).ToList();
});

答案 1 :(得分:0)

对于您的描述,您想要的是

var Z= B.Where(arg=>arg.A.Any(args=>args.Id == guid));

您希望所有B个元素WHERE和所有A个元素WHERE Id = Guid。