close

        List<CTAccounts> list = new List<CTAccounts>();
        for (int i = 0; i < 5; i++)
        {
            CTAccounts c = new CTAccounts();
            c.FProduct = "Pd" + i;
            c.FPrice = i * 50;
            list.Add(c);
        }
        IEnumerable <CTAccounts> query = from ta in list
                                 where ta.Fcount == 0
                                 select ta;
        foreach (CTAccounts t in query)
        {
            int a = t.Fcount + 1;
        }

        ArrayList l_alist = new ArrayList();
        for (int i = 0; i < 5; i++)
        {
            CTAccounts c = new CTAccounts();
            c.FProduct = "Pd" + i;
            c.FPrice = i * 50;
            l_alist.Add(c);
        }

        List<CTAccounts> query2 =( from CTAccounts ta2 in l_alist
                                  select ta2).ToList ();
        foreach (CTAccounts c in query2)
            c.FDate =  DateTime.Now.ToString("yyyy-MM-dd");

Where Sample:

         List<Ctcustomer>  newList = oldList.Where(p => p.fName == "aa").ToList <Ctcustomer >();

Sum Sample:

        int  total  = oldList.Sum(p => p.fPrice);

arrow
arrow
    全站熱搜

    Ryan 發表在 痞客邦 留言(0) 人氣()