Click here to Skip to main content
15,921,793 members
Home / Discussions / C#
   

C#

 
QuestionSession level connection object Pin
abhishek agrawal19836-Apr-09 23:07
abhishek agrawal19836-Apr-09 23:07 
Questionviewing all fonts in "windows/fonts" Pin
tai-fun6-Apr-09 22:42
tai-fun6-Apr-09 22:42 
AnswerRe: viewing all fonts in "windows/fonts" Pin
Henry Minute7-Apr-09 1:42
Henry Minute7-Apr-09 1:42 
QuestionHow to do unit testing to non-function? [modified] Pin
BabyOreo6-Apr-09 22:42
BabyOreo6-Apr-09 22:42 
QuestionSearch through list of objects. Pin
xkrja6-Apr-09 22:36
xkrja6-Apr-09 22:36 
AnswerRe: Search through list of objects. Pin
Christian Graus7-Apr-09 0:38
protectorChristian Graus7-Apr-09 0:38 
AnswerRe: Search through list of objects. Pin
MumbleB7-Apr-09 3:45
MumbleB7-Apr-09 3:45 
GeneralRe: Search through list of objects. Pin
xkrja7-Apr-09 4:44
xkrja7-Apr-09 4:44 
Thanks for your replies.

I came up with a solution that worked well but I don't know if it's optimal:

I search through all the information stored in each customer in the list. If the information in the customer object matches the information the user typed in the textbox the result is stored in a new list. If the information in the search textbox is empty it's also seen as a match. See below:

public int[] SearchCustomers(Customer searchCustomer)
{
//Create list for search results.
searchResult = new List<Customer>();

//Loop through all information in the customer-objects.
searchResult = customers.FindAll(delegate(Customer C) { return SearchFirstName(C, searchCustomer); });
searchResult = searchResult.FindAll(delegate(Customer C) { return SearchLastName(C, searchCustomer); });

searchResult = searchResult.FindAll(delegate(Customer C) { return SearchCity(C, searchCustomer); });
searchResult = searchResult.FindAll(delegate(Customer C) { return SearchCountry(C, searchCustomer); });
searchResult = searchResult.FindAll(delegate(Customer C) { return SearchStreet(C, searchCustomer); });
searchResult = searchResult.FindAll(delegate(Customer C) { return SearchZip(C, searchCustomer); });

searchResult = searchResult.FindAll(delegate(Customer C) { return SearchCellPhone(C, searchCustomer); });
searchResult = searchResult.FindAll(delegate(Customer C) { return SearchHomePhone(C, searchCustomer); });

searchResult = searchResult.FindAll(delegate(Customer C) { return SearchEmail(C, searchCustomer); });

The final result is a list containing the matches of all search words.
QuestionCompress and extract a folder Pin
yesu prakash6-Apr-09 21:37
yesu prakash6-Apr-09 21:37 
AnswerRe: Compress and extract a folder Pin
Christian Graus6-Apr-09 21:39
protectorChristian Graus6-Apr-09 21:39 
GeneralRe: Compress and extract a folder Pin
Vikram A Punathambekar6-Apr-09 22:11
Vikram A Punathambekar6-Apr-09 22:11 
AnswerRe: Compress and extract a folder Pin
12Code6-Apr-09 21:59
12Code6-Apr-09 21:59 
AnswerRe: Compress and extract a folder Pin
12Code6-Apr-09 21:59
12Code6-Apr-09 21:59 
AnswerRe: Compress and extract a folder Pin
Vasudevan Deepak Kumar6-Apr-09 23:34
Vasudevan Deepak Kumar6-Apr-09 23:34 
AnswerRe: Compress and extract a folder Pin
Laddie7-Apr-09 0:58
Laddie7-Apr-09 0:58 
QuestionOracleClient.OracleException ORA-06550 with anonymous block taking no argument [modified] Pin
devvvy6-Apr-09 21:35
devvvy6-Apr-09 21:35 
AnswerRe: OracleClient.OracleException ORA-06550 with anonymous block taking no argument Pin
devvvy7-Apr-09 0:57
devvvy7-Apr-09 0:57 
QuestionCheckedListBox Pin
mrithula86-Apr-09 21:07
mrithula86-Apr-09 21:07 
AnswerRe: CheckedListBox Pin
Henry Minute7-Apr-09 1:29
Henry Minute7-Apr-09 1:29 
QuestionHow to read multiple lines from a file and save them into one variable (to be saved into the DB) Pin
Nopo6-Apr-09 21:01
Nopo6-Apr-09 21:01 
AnswerRe: How to read multiple lines from a file and save them into one variable (to be saved into the DB) Pin
Luc Pattyn7-Apr-09 4:13
sitebuilderLuc Pattyn7-Apr-09 4:13 
QuestionAccessing control from multiple forms Pin
mrithula86-Apr-09 20:50
mrithula86-Apr-09 20:50 
AnswerRe: Accessing control from multiple forms Pin
Christian Graus6-Apr-09 21:40
protectorChristian Graus6-Apr-09 21:40 
QuestionAbstract And Interface Pin
Isaac Gordon6-Apr-09 20:46
Isaac Gordon6-Apr-09 20:46 
AnswerRe: Abstract And Interface Pin
Vikram A Punathambekar6-Apr-09 21:29
Vikram A Punathambekar6-Apr-09 21:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.