DGilbert

DGilbert

  • NA
  • 3
  • 0

Split a String to Byte Array

Jun 12 2004 5:49 PM
I have a string that contains an IP address. I am trying to split that based upon the "." into a byte array so I can loop through the range of IP addresses. I can convert on the loop itself, but this seems to be a slow way. My code looks like this.... string [] bStartAddress = null; bStartAddress = strTempAddress.Split(new Char [] {'.'}); I have tried... bStartAddress = Convert.ToByte(strTempAddress.Split(new Char [] {'.'})); but I get an error message that says I cannot convert a byte to a byte. Please excuse my ignorance if there is an easy solution, I am a VB programmer trying to make my way to C#. VB will implicitly convert a string to a byte on the fly, so I never had to deal with this. Thanks in advance for any suggestions.

Answers (2)