public void TransformStringToValuesAndDates(string _text) { List <int> valuesList = new List <int> { }; List <DateTime> datesList = new List <DateTime> { }; int posStart = 0; int posEnd = -1; bool checkForValue = true; for (int i = 0; i < _text.Length; i++) { switch (checkForValue) { case true: if (_text[i].Equals('&')) { posEnd = i; string ghj = _text.Substring(posStart, posEnd - posStart); valuesList.Add(int.Parse(ghj)); checkForValue = false; posStart = i + 1; } break; case false: if (_text[i].Equals('@')) { posEnd = i; string gh = _text.Substring(posStart, posEnd - posStart); datesList.Add(DateTime.Parse(gh)); checkForValue = true; posStart = i + 1; } break; } } //тут, в зависимости откуда вызвали, передаем в нужный класс два списка if (controlSemCoreArchiveView != null) { //вызывает два метода из этого класса controlSemCoreArchiveView.GetDatesForKey(datesList); controlSemCoreArchiveView.GetValuesForKey(valuesList); } }