K
Kevin G
Hi. I'm trying to prepare an example on how to use List.ForEach.
using the regular ForEach, I can get what I want with the folllowing
code:
List<string> lAvailablePorts = new List<string>();
lAvailablePorts.AddRange(SerialPort.GetPortNames());
string sPortsAvailable = "";
foreach (string sPort in lAvailablePorts)
{
sPortsAvailable += " " + sPort;
}
this.LogThis("Ports Available: " + sPortsAvailable);
however, I think I can do it like this:
List<string> lAvailablePorts = new List<string>();
lAvailablePorts.AddRange(SerialPort.GetPortNames());
this.LogThis("Ports Available: " + lAvailablePorts.ForEach(What
Do I put Here?));
can anyone help me out with the syntax?
-K
using the regular ForEach, I can get what I want with the folllowing
code:
List<string> lAvailablePorts = new List<string>();
lAvailablePorts.AddRange(SerialPort.GetPortNames());
string sPortsAvailable = "";
foreach (string sPort in lAvailablePorts)
{
sPortsAvailable += " " + sPort;
}
this.LogThis("Ports Available: " + sPortsAvailable);
however, I think I can do it like this:
List<string> lAvailablePorts = new List<string>();
lAvailablePorts.AddRange(SerialPort.GetPortNames());
this.LogThis("Ports Available: " + lAvailablePorts.ForEach(What
Do I put Here?));
can anyone help me out with the syntax?
-K