using System.Collections.Generic;
using System.Linq.Expressions;
public static void Main()
List<Person> peopleWhoLiveInFlorida = GetPersonInAddress("Florida");
int countPeopleWhoWorkInIncCompany = GetPersonCountFromCompanyName("Inc");
List<Person> peopleRandom = GetRandomPerson(2);
for(int i=0;i<peopleWhoLiveInFlorida.Count;i++)
Console.WriteLine(peopleWhoLiveInFlorida[i].Address);
Console.WriteLine("countPeopleWhoWorkInIncCompany:"+countPeopleWhoWorkInIncCompany);
for(int i=0;i<peopleRandom.Count;i++)
Console.WriteLine(peopleRandom[i].FullName);
public static List<Person> GetPersonList(){
var test = new List<Person>();
for (int i = 0; i < 20; i++) {
DateTime dt=DateTime.Now.AddYears(-r);
test.Add(new Person(Faker.Name.FullName(),dt.ToString(), Faker.Business.CreditCardNumber(), Faker.Company.Name(), Faker.Address.State()));
public static List<Person> GetPersonInAddress(string address){
List<Person> peopleWhoLiveInFlorida=new List<Person>();
foreach(Person p in GetPersonList()){
if(p.Address.Contains((address))){
peopleWhoLiveInFlorida.Add(p);
return peopleWhoLiveInFlorida;
public static List<Person> GetRandomPerson(int count){
List<Person> allPeople=GetPersonList();
List<Person> randomList=new List<Person>();
if(count>allPeople.Count)
if(randomList.Contains((allPeople[r]))){
randomList.Add(allPeople[r]);
if(cntr>100 && randomList.Count>9){
public static int GetPersonCountFromCompanyName(string company){
List<Person> peopleWhoWorkInInc=new List<Person>();
foreach(Person p in GetPersonList()){
if(p.Address.Contains((company))){
peopleWhoWorkInInc.Add(p);
return peopleWhoWorkInInc.Count;
public string FullName {get; set;}
public string DateofBirth {get; set;}
public string CreditCardNumber {get; set;}
public string Company {get; set;}
public string Address {get; set;}
public Person(string fullName,string dateofBirth,string creditCardNumber,string company,string address){
this.DateofBirth=dateofBirth;
this.CreditCardNumber=creditCardNumber;