-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0378c6e
commit c9af020
Showing
5 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
Console.WriteLine("Hello, World!"); | ||
using N23_HT2; | ||
|
||
|
||
var Users = new List<User> | ||
{ | ||
new User("John", "Doe", "[email protected]"), | ||
new User("Jane", "Doe", "[email protected]"), | ||
new User("Bob", "Smith", "[email protected]"), | ||
new User("Alice", "Johnson", "[email protected]"), | ||
new User("Mike", "Brown", "[email protected]"), | ||
new User("Emily", "Davis", "[email protected]"), | ||
new User("David", "Wilson", "[email protected]"), | ||
new User("Sarah", "Taylor", "[email protected]"), | ||
new User("Tom", "Anderson", "[email protected]"), | ||
new User("Lisa", "Thomas", "[email protected]") | ||
}; | ||
|
||
Console.WriteLine("Enter the keyword"); | ||
var keyvord = Console.ReadLine(); | ||
|
||
Users.Where(user => user.FirstName.Contains(keyvord, StringComparison.OrdinalIgnoreCase) | ||
|| user.LastName.Contains(keyvord, StringComparison.OrdinalIgnoreCase) | ||
|| user.EmailAddress.Contains(keyvord, StringComparison.OrdinalIgnoreCase)).ToList() | ||
.ForEach(user => | ||
Console.WriteLine($"{user.FirstName.PadRight(15)} {user.LastName.PadRight(15)} - {user.EmailAddress}")); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace N23_HT2 | ||
{ | ||
public class User | ||
{ | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
public string EmailAddress { get; set; } | ||
|
||
public User(string firstname, string lastname, string email) | ||
{ | ||
FirstName = firstname; | ||
LastName = lastname; | ||
EmailAddress = email; | ||
} | ||
|
||
} | ||
} |