private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
{
departComboBox.SelectedItem = _departmentList.FirstOrDefault(d => d.Id == _clientList.Find(item => item == (Client)clientComboBox.SelectedItem).DepartmentId);
}
StreamReader _reader = new StreamReader(path);
public string GetNext()
{
string line;
while ((line = _reader.ReadLine()) != null)
{
var message = WorkWithLine(line);
if (message != null)
return message;
}
return null;
}
}
public string WorkWithLine(string line)
{
var ip = Regex.Match(line, "IP: .*?\n");
if (ip.Value.Length > 0)
return null;
return ip.Value;
}
Использование:
void Do()
{
string msg;
while(while ((msg = GetNext()) != null)
Console.WriteLine(msg);)
}