Click here to Skip to main content
15,906,569 members
Home / Discussions / C#
   

C#

 
AnswerRe: Holding data in memory Pin
OriginalGriff16-Jan-10 1:01
mveOriginalGriff16-Jan-10 1:01 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 1:16
Bardy8516-Jan-10 1:16 
GeneralRe: Holding data in memory Pin
N a v a n e e t h16-Jan-10 6:05
N a v a n e e t h16-Jan-10 6:05 
GeneralRe: Holding data in memory Pin
Dan Mos16-Jan-10 7:21
Dan Mos16-Jan-10 7:21 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 9:21
Bardy8516-Jan-10 9:21 
GeneralRe: Holding data in memory Pin
Luc Pattyn16-Jan-10 10:05
sitebuilderLuc Pattyn16-Jan-10 10:05 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 10:56
Bardy8516-Jan-10 10:56 
GeneralRe: Holding data in memory [modified] Pin
Dan Mos16-Jan-10 11:01
Dan Mos16-Jan-10 11:01 
Bardy85 wrote:
I currently do implement IComparable, but don't sort the list of Objects or Use BinarySearch.
I guess this would speed up things up. Only problem I see is that BinarySearch does not take a Predicate as an arguement, and I use Predicates to find a matching object.
Do you know another way arround this? For example my Employee object has quite a few fields and I don't always want to search where the whole employee object matches, only maybe ID or Lastname, thats why I like using Predicates. In your above example you can only search on Name.


True. But it totally depends on what you want to do with the data. In my case there is just one table/class that needs to be sorted on different filed(s) for different reports.

One way to use Binary search no matter the field or fields is to sort the List proving a custom IComparer each time. This makes sence ONLY IF after you sort the list you do a lot of searching
using that comparer cause the Sort time is O(n) = n* log(n) while a LINQ/Predicate is O(n)=n, but if you do a lot of searching after sorting by the "ocupation" filed for example, then the extra time needed for sorting is totally worth the while. Hope you get what I tried to say.

modified on Saturday, January 16, 2010 5:40 PM

GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 9:28
Bardy8516-Jan-10 9:28 
GeneralRe: Holding data in memory Pin
Dan Mos16-Jan-10 10:48
Dan Mos16-Jan-10 10:48 
QuestionSystem.Drawing.Graphics Problem Pin
logicon15-Jan-10 23:17
logicon15-Jan-10 23:17 
AnswerRe: System.Drawing.Graphics Problem Pin
OriginalGriff15-Jan-10 23:34
mveOriginalGriff15-Jan-10 23:34 
GeneralRe: System.Drawing.Graphics Problem Pin
logicon16-Jan-10 0:38
logicon16-Jan-10 0:38 
GeneralRe: System.Drawing.Graphics Problem Pin
OriginalGriff16-Jan-10 0:54
mveOriginalGriff16-Jan-10 0:54 
QuestionAdd an Item to a ListView in VitualMode ? Pin
Mohammad Dayyan15-Jan-10 22:48
Mohammad Dayyan15-Jan-10 22:48 
AnswerRe: Add an Item to a ListView in VitualMode ? Pin
MumbleB16-Jan-10 5:41
MumbleB16-Jan-10 5:41 
GeneralRe: Add an Item to a ListView in VitualMode ? Pin
Mohammad Dayyan16-Jan-10 6:52
Mohammad Dayyan16-Jan-10 6:52 
QuestionDirectX Support In C#.Net Pin
ashwath197915-Jan-10 20:10
ashwath197915-Jan-10 20:10 
AnswerMessage Closed Pin
15-Jan-10 20:49
stancrm15-Jan-10 20:49 
GeneralRe: DirectX Support In C#.Net Pin
ashwath197916-Jan-10 0:32
ashwath197916-Jan-10 0:32 
GeneralMessage Closed Pin
16-Jan-10 1:02
stancrm16-Jan-10 1:02 
GeneralRe: DirectX Support In C#.Net Pin
ashwath197916-Jan-10 1:10
ashwath197916-Jan-10 1:10 
GeneralRe: DirectX Support In C#.Net Pin
#realJSOP16-Jan-10 1:21
professional#realJSOP16-Jan-10 1:21 
QuestionUser Interface for Windows Form Pin
sjs4u15-Jan-10 18:21
sjs4u15-Jan-10 18:21 
AnswerRe: User Interface for Windows Form Pin
N a v a n e e t h15-Jan-10 18:38
N a v a n e e t h15-Jan-10 18:38 

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.