Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
AnswerRe: Need help with drawing circles on mouse click event in pictureBox Pin
Dan Mos16-Jan-10 7:53
Dan Mos16-Jan-10 7:53 
QuestionBackgroundWorker with anonymous methods ? Pin
Mohammad Dayyan16-Jan-10 4:06
Mohammad Dayyan16-Jan-10 4:06 
AnswerRe: BackgroundWorker with anonymous methods ? Pin
Nicholas Butler16-Jan-10 4:59
sitebuilderNicholas Butler16-Jan-10 4:59 
GeneralRe: BackgroundWorker with anonymous methods ? Pin
Mohammad Dayyan16-Jan-10 6:58
Mohammad Dayyan16-Jan-10 6:58 
QuestionHolding data in memory Pin
Bardy8516-Jan-10 0:22
Bardy8516-Jan-10 0:22 
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 
Bardy85 wrote:
Tools.DB.OL.Xtime.EMPLOYEE employee = new Tools.DB.OL.Xtime.EMPLOYEE();
if (listEMPLOYEE.Exists(p))
{
employee = listEMPLOYEE.Find(p);
}


This code is inefficient. listEMPLOYEE.Exists(p) loops through the items in the list to return the result. employee = listEMPLOYEE.Find(p); will again do a iteration on all items and leading into worst performance. You can do something like the following instead.
Tools.DB.OL.Xtime.EMPLOYEE employee = listEMPLOYEE.Find(p); // employee will be null if not found
return employee;

Bardy85 wrote:
There can be up to about 5000 or so Employee records.


How often do you search on this records? If it is quite frequent, your approach is inefficient. Because, list has sequential storage and searches will lead into O(n) complexity. In such cases, querying database will be efficient. If you still need to keep the items in memory, consider a much superior data structure than a normal list.

If you have a one to one mapping like, getting employee object from the employee name, use a Dictionary where name will be the key and employee instance will be the value. This will give you constant (O(1)) complexity. Another alternative is to use a sorted list and do binary search for lookup. This will lead into logarithmic complexity and quite efficient with huge recordsets.



Smile | :)

Best wishes,
Navaneeth

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 
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 

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.