المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Accessing an array from another function ?



C# Programming
06-15-2009, 08:40 PM
private void LoadSettings()
{
string[] lines = File.ReadAllLines("settings.txt");
foreach (string line in lines)
{
if (line == "" || line.StartsWith(" ") || line.StartsWith("/")) continue; // ignore comments or blank lines
string[] splitArray = line.Split(new char[] { '=' });
MessageBox.Show(splitArray[1]);
}
MessageBox.Show(splitArray[1]);
}

Im having a problem with the code above the array splitArray can be accessed inside the for-each loop but i get a ide exception if i try to access it anywhere else . Is there any way to make the array items available anywhere in the form ?