Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FirstExampleRefactored
- {
- using System;
- using System.Collections.Generic;
- class Program
- {
- static void Main()
- {
- string[] people = new string[3] { "Don", "Steve", "Michael" };
- Console.WriteLine(FoundPerson(people));
- }
- static string FoundPerson(string[] people)
- {
- List<string> candidates = new List<string>() { "Don", "John", "Kent" };
- for (int i = 0; i < people.Length; i++)
- {
- if (candidates.Contains(people[i]))
- {
- return people[i];
- }
- }
- return String.Empty;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement