lundi 27 août 2018

Code Rewite for tuple and if else statements by using LINQ

In my C# application i am using linq. I need a help what is the syntax for if-elseif- using linq in single line. Here is the code:

        var Date1 = RangeData.ToList();

        foreach (var tr in Date1)
        {
           int id =0;

            if (tr >0)
            {
               id =1;
            }
            else if (tr >3)
            {
               id =2;
            }
            if (id > 0)
            {
                //
            }
        }

Aucun commentaire:

Enregistrer un commentaire