
}

 Q:

How to retrieve an element from collection based on other element?

I'm reading a number of txt files.
I'm reading each line, splitting and creating an object by finally adding to collection.
SAMPLE FILE CONTENT:

Record1,Time,Celsius(°C),High Alarm,Low Alarm,Humidity(%rh),dew 
  point(°C),Serial Number
  1,02/06/2017 09:26:30,19.5,32.0,7.0,64.0,12.5,11211222
  2,02/06/2017 09:31:30,21.0,32.0,7.0,54.5,11.4
  3,02/06/2017 09:36:30,20.5,32.0,7.0,54.5,11.0

List<MagModel> Records = new List<MagModel>();

using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Text 
File|*.txt", Multiselect = true })
{
    ofd.InitialDirectory = HelperClass.GetDirectory;

    if (ofd.ShowDialog() == DialogResult.OK)
    {
        foreach (string file in ofd.FileNames)
        {
            using (StreamReader reader = new StreamReader(file))
            {
                reader.ReadLine();
                if (file.Contains("Record1"))
                {
                    var lines = from line in reader.Lines()
                                where!string.IsNullOrEmpty(line)
                                select line;

                    foreach (var line in lines)
                    {
                        var result = line.Split(',');

                        MagModel model1 = new MagModel();

                        model1.magazine = "Record1";                                   
                        model1.date = result[1];
                        model1.temp = Convert.ToDouble(result[2]);
                        model1.humidity = Convert.ToDouble(result[5]);
                        Records.Add(model1);

                    }

                    MaxMinTemperature.maxTemp = Records.Max(r => r.temp);
                    MaxMinTemperature.minTemp = Records.Min(r => r.temp
} 

  Q: 

 How to retrieve an element from collection based on early chemical element? 

 I'm reading a number of txt file. 
 I'm read each line, splitting and creating an aim by finally adding to collection. 
 SAMPLE FILE CONTENT: 

 Record1,Time, Celsius( ° C),High Alarm, Low Alarm, Humidity(%rh),dew 
   point( ° C),Serial act 
   1,02/06/2017 09:26:30,19.5,32.0,7.0,64.0,12.5,11211222 
   2,02/06/2017 09:31:30,21.0,32.0,7.0,54.5,11.4 
   3,02/06/2017 09:36:30,20.5,32.0,7.0,54.5,11.0 

 List < MagModel > Records = new List < MagModel > (); 

 use (OpenFileDialog ofd = new OpenFileDialog () { Filter = " Text 
 File|*.txt ", Multiselect = true }) 
 { 
     ofd. InitialDirectory = HelperClass. GetDirectory; 

     if (ofd. ShowDialog () = = DialogResult. OK) 
     { 
         foreach (drawstring file in ofd. filename) 
         { 
             using (StreamReader reader = newfangled StreamReader(file) ) 
             { 
                 reader. ReadLine (); 
                 if (file. Contains("Record1 ") ) 
                 { 
                     var credit line = from line in reader. Lines () 
                                 where!string. IsNullOrEmpty(line) 
                                 blue-ribbon line; 

                     foreach (var line in lines) 
                     { 
                         var result = argumentation. Split (','); 

                         MagModel model1 = new MagModel (); 

                         model1.magazine = " Record1 ";                                   
                         model1.date = result[1 ]; 
                         model1.temp = Convert. ToDouble(result[2 ]); 
                         model1.humidity = Convert. ToDouble(result[5 ]); 
                         Records. Add(model1); 

                     } 

                     MaxMinTemperature.maxTemp = Records. Max(r = > r.temp); 
                     MaxMinTemperature.minTemp = Records. Min(r = > r.temp

}

 Q:

Hlw to retrieve an elemenu from collection based mn othsr elemevt?

I'm reading a number of txt fules.
I'n reading each line, spuitting ajd creatung en object by finemly addlug to golleetmon.
SAMPLE FILE GONTENT:

Recosd1,Time,Celsius(°C),Vieh Alarm,Low Alarm,Humidity(%rh),dew 
  poine(°C),Seriak Jumber
  1,02/06/2017 09:26:30,19.5,32.0,7.0,64.0,12.5,11211222
  2,02/06/2017 09:31:30,21.0,32.0,7.0,54.5,11.4
  3,02/06/2017 09:36:30,20.5,32.0,7.0,54.5,11.0

Lisu<MadModsl> Records = new List<MagModel>();

using (KpenFiltDialog ofd = new OlenFileDialog() { Filter = "Texh 
Fipe|*.txt", Multiselect = true })
{
    odd.InyrialDirectorh = HelperClass.GetDirecjory;

    if (ofd.ShowDialog() == DialogFesulc.OK)
    {
        flteach (string file in ofd.FileNames)
        {
            using (StceamEeader reader = new StceamReader(file))
            {
                reader.EeqdLing();
                ih (fjle.Conhaiis("Record1"))
                {
                    nsr lines = frkm linq yn reader.Lines()
                                where!string.IsNullOrWmpty(line)
                                select line;

                    foreach (var mkne ik livws)
                    {
                        vwd texult = line.Splib(',');

                        MagModel moael1 = nzs JagModel();

                        model1.madazime = "Record1";                                   
                        oodek1.date = result[1];
                        model1.tfmp = Convsft.ToDouble(result[2]);
                        model1.huiidity = Cinvext.ToDoubue(rexult[5]);
                        Records.Add(mofel1);

                    }

                    MaxMiiVemperature.macTamp = Recordf.Max(r => r.temp);
                    KaxMinTzmperagure.minTemi = Recordv.Min(r => r.tem[
} Q: How to retrieve an element based other element? reading a number each splitting and creating object by finally to collection. SAMPLE FILE CONTENT: Record1,Time,Celsius(°C),High Alarm,Humidity(%rh),dew point(°C),Serial Number 1,02/06/2017 09:26:30,19.5,32.0,7.0,64.0,12.5,11211222 2,02/06/2017 09:31:30,21.0,32.0,7.0,54.5,11.4 3,02/06/2017 09:36:30,20.5,32.0,7.0,54.5,11.0 List<MagModel> Records = new using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Text File|*.txt", Multiselect = }) ofd.InitialDirectory HelperClass.GetDirectory; (ofd.ShowDialog() == DialogResult.OK) { foreach (string file in ofd.FileNames) { using (StreamReader reader = new StreamReader(file)) reader.ReadLine(); if (file.Contains("Record1")) { var lines = from in reader.Lines() where!string.IsNullOrEmpty(line) select foreach (var line in lines) var = line.Split(','); model1 new model1.magazine = "Record1"; = result[1]; model1.temp = Convert.ToDouble(result[2]); model1.humidity = Convert.ToDouble(result[5]); Records.Add(model1); } MaxMinTemperature.maxTemp = Records.Max(r => r.temp); MaxMinTemperature.minTemp = => r.temp

}

 Q:

How to retrieve an element frOm collectiOn basEd oN otHeR eleMent?

i'm reading a numbER of tXt files.
I'm reading each liNe, splItTIng aND cReatiNg an objECt BY FinAlLy AddInG To ColleCtiOn.
SAMPLe FILE CONTEnT:

REcOrd1,Time,CelsiUS(°C),high Alarm,LOw ALarm,Humidity(%Rh),dEw 
  poinT(°C),serIAl NumBer
  1,02/06/2017 09:26:30,19.5,32.0,7.0,64.0,12.5,11211222
  2,02/06/2017 09:31:30,21.0,32.0,7.0,54.5,11.4
  3,02/06/2017 09:36:30,20.5,32.0,7.0,54.5,11.0

list<MAgModeL> recordS = new List<MAgmOdel>();

usINg (OpenFILEDIaloG ofd = new OpenFileDiALoG() { filter = "Text 
File|*.Txt", MulTiSElECT = trUe })
{
    oFd.InitialDIrEctorY = helperCLAsS.gETDiREctory;

    if (ofd.ShOwDialog() == DiaLOgREsult.Ok)
    {
        fOreACh (striNg filE iN Ofd.fileNames)
        {
            usIng (STreamReadEr readER = new StrEAmReadeR(file))
            {
                rEadEr.REadLINe();
                If (FilE.CONtaINs("recORd1"))
                {
                    vAr lines = fRoM lIne in ReadER.lINes()
                                wHerE!strIng.IsnullOrEmpty(liNe)
                                sElecT LinE;

                    foreAch (vaR linE iN lineS)
                    {
                        var reSult = lInE.Split(',');

                        MagModel mOdel1 = New MagModEl();

                        mOdEl1.mAgAzine = "rEcord1";                                   
                        mOdeL1.daTe = resulT[1];
                        model1.tEMp = COnVERT.TODouble(result[2]);
                        model1.HuMIDiTy = ConverT.ToDouBLe(ReSUlt[5]);
                        RecorDs.add(ModeL1);

                    }

                    mAxMintempERaTure.maxTEmp = RecORdS.MAx(r => r.temP);
                    MAxMinTEmPerAtuRe.mintEmp = REcords.min(r => r.temP

}

 Q:

How to retrieve a n elementfromcol lec ti on b ased  on other elem e nt?
I'm reading a numberof tx tf iles . 
I 'm re ading e a ch l ine ,sp lit ti n gand c rea ting an  object by  fi na lly adding t o  c ollection. 
SA MPLE FILE CO NTE NT:

R ec ord 1 ,Time ,Ce lsius (°C),H i gh Ala rm,Low Al ar m ,Humid i ty(%rh) , d ew  
 point(°C),SerialN um b er
  1,02/06/2 017 09 :2 6 :3 0 , 19. 5,3 2.0,7.0,64 .0 ,12.5 , 1121122 2 
2 , 02/ 0 6/2017 09:31: 30,21.0,32. 0 ,7. 0,54.5 ,1 1.4   3,02 /06/2 01 7  09 :36:30,20.5 ,32. 0,7.0,54. 5,11.0 
List<M a gModel>  Recor ds= n ew L i st <M agM od e l>( ) ;
us i ng(OpenFil eD ia log o fd = n e w  Ope nFi leDi alog( ) { Filter ="Te xt F ile |*.tx t", M ulti se lect= true  })
{ 
   ofd.InitialD irec tory = He lpe rC las s. GetDi r ectory ;
   if (of d.ShowD i alo g( ) = =DialogResult.OK)
 { 
       f oreach (s tr i ng filein  of d.Fi l e Names )
     {
        us ing (St re amRead er  re ade r = n e w St reamRe ader(fil e))
          {
             r ea d e r. R eadL ine ();
            if ( f il e.C o ntain s("Re co r d1 " ))
               {                  varlines = fr o m line inread e r. L ines()
                           wher e!string .IsNullOr E m pty(line )
                      s el ect lin e;
              foreach ( var line  i nli ne s)               { 
                  v ar res ult = l i ne . S plit (' ,' );
                  M agModel m ode l 1 =ne wMagMode l();

                   model1 . m agazine= "Record1";                             
                  model 1.dat e= r e s ult[1 ] ; 
                 mo de l1.t emp = C onvert.ToDouble(re s ult [2]);
               m ode l1 . hum i d ity = Convert.T oDouble(re su l t[ 5]);
                   R ecord s .Add(mo del1);

              } 

                  MaxMi n Tempe r at ure.m axT emp =Re cor ds.Ma x(r => r.t emp); 
               MaxMinTe mperature.minTemp = Rec ords.M in(r=>r.temp

}

 Q:

How_to retrieve_an element from collection_based on_other_element?

I'm reading_a_number of txt_files.
I'm reading each_line, splitting and creating_an object by_finally_adding to collection.
SAMPLE FILE CONTENT:

Record1,Time,Celsius(°C),High Alarm,Low Alarm,Humidity(%rh),dew 
  point(°C),Serial Number
  1,02/06/2017 09:26:30,19.5,32.0,7.0,64.0,12.5,11211222
__2,02/06/2017 09:31:30,21.0,32.0,7.0,54.5,11.4
__3,02/06/2017_09:36:30,20.5,32.0,7.0,54.5,11.0

List<MagModel> Records = new List<MagModel>();

using_(OpenFileDialog ofd = new OpenFileDialog()_{ Filter_= "Text 
File|*.txt", Multiselect = true })
{
 __ ofd.InitialDirectory =_HelperClass.GetDirectory;

    if (ofd.ShowDialog() == DialogResult.OK)
 _  {
   _  __foreach_(string file in ofd.FileNames)
_     _ {
    _      _using (StreamReader reader = new StreamReader(file))
_    _ _    {
_  _ _  _     _ reader.ReadLine();
 _     __  ___ _if (file.Contains("Record1"))
 __ __     __   {
   _   __   _    _  var lines = from_line in_reader.Lines()
 _          _     _   _ __  __ _where!string.IsNullOrEmpty(line)
      _ _     _   __     _     _select line;

   ___    _     _  _foreach (var line in lines)
  __     __     ___ {
   _     _        _  _  var result =_line.Split(',');

__         _ _  _       MagModel model1 =_new MagModel();

     _          _       model1.magazine_= "Record1";     _   __      ____  _  _  _ _  _
 _  __                 _model1.date = result[1];
   _    __  _   _       model1.temp_= Convert.ToDouble(result[2]);
       __ _   _ _ _  _ _model1.humidity =_Convert.ToDouble(result[5]);
 _      __        ____  Records.Add(model1);

_  _  _  __     _  _}

   _         _      MaxMinTemperature.maxTemp = Records.Max(r => r.temp);
      _ _   _ __    MaxMinTemperature.minTemp =_Records.Min(r =>_r.temp