Im new to C# and was wondering if there was a more elegant way to do the following:
thanks in advance for any help!
VB Code:
if (ofd1.ShowDialog() == DialogResult.OK) { System.IO.StreamReader objFile = new System.IO.StreamReader(ofd1.FileName); string[] arrFirst = objFile.ReadToEnd().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); objFile.Close(); objFile.Dispose(); //int intUB = arrFirst.GetUpperBound(0); string[,] arrSecond; arrSecond = new string[ arrFirst.GetUpperBound(0),2]; string[] arrTemp; arrTemp = new string[1]; for (int intCounter = 0; intCounter <= arrFirst.GetUpperBound(0) - 1; intCounter++) { arrTemp = arrFirst[intCounter].Split(','); arrSecond[ intCounter,0] = arrTemp[0]; arrSecond[intCounter,1] = arrTemp[1]; } }




Reply With Quote