Reputation: 370
I am aware of the syntax used to get the port names
string[] ports = SerialPort.GetPortNames();
The output is not quite as expected. When I go on to print the strings, the output is;
System.String[]
I am probably missing something. Kindly help...
Upvotes: 0
Views: 833
Reputation: 451
You are printing the array object not the strings in the array:
for(int i=0; i<ports.Length; i++)
{
Console.WriteLine(ports[i]);
}
Or use:
foreach(String port in ports)
{
Console.WriteLine(port);
}
Upvotes: 1