Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string Saerch(string searchingParams)
- {
- string searchingSymbols = searchingParams;
- List<Contact> result = new List<Contact>();
- foreach (var contact in contacts)
- {
- if (contact.Name.Contains(searchingSymbols))
- {
- result.Add(contact);
- }
- }
- if (result.Count == 0)
- {
- throw new Exception("No contacts found");
- }
- var builder = new StringBuilder();
- if (result.Count > 0)
- {
- foreach (var contact in result)
- {
- builder.AppendLine(contact.GetContactInfo());
- }
- }
- return builder.ToString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement