SORU
8 ŞUBAT 2011, Salı


eğer kontrol Listesi nasıl<T> öğesi, Belirli bir Özellik Değeri olan bir öğe içeriyor

public class PricePublicModel
{
    public PricePublicModel() { }

    public int PriceGroupID { get; set; }
    public double Size { get; set; }
    public double Size2 { get; set; }
    public int[] PrintType { get; set; }
    public double[] Price { get; set; }
}

List<PricePublicModel> pricePublicList = new List<PricePublicModel>();

Nasıl olursa pricePublicList element belli değer varsa kontrol etmek için. Daha net olmak gerekirse, eğer pricePublicModel.Size == 200 varsa orayı kontrol etmek istiyorum? Hangisi olduğunu nasıl eğer bu öğe varsa da,,?

Eğer Sözlük o zaman Sözlük kullanabilirim bu, ama bilmek gerekir:) için daha uygun olup Olmadığını DÜZENLEYİN

CEVAP
8 ŞUBAT 2011, Salı


bool contains = pricePublicList.Any(p => p.Size == 200);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Jana Williams

    Jana William

    17 AĞUSTOS 2011
  • NightShader1

    NightShader1

    25 Temmuz 2006
  • Schmittastic Jr.

    Schmittastic

    19 Mart 2013