Click here to Skip to main content
15,895,740 members
Home / Discussions / C#
   

C#

 
QuestionWhich is more correct? Pin
Bardy8517-Jan-10 6:25
Bardy8517-Jan-10 6:25 
AnswerRe: Which is more correct? Pin
harold aptroot17-Jan-10 6:30
harold aptroot17-Jan-10 6:30 
GeneralRe: Which is more correct? Pin
Bardy8517-Jan-10 6:52
Bardy8517-Jan-10 6:52 
GeneralRe: Which is more correct? Pin
Eddy Vluggen17-Jan-10 9:22
professionalEddy Vluggen17-Jan-10 9:22 
AnswerRe: Which is more correct? Pin
#realJSOP17-Jan-10 7:06
mve#realJSOP17-Jan-10 7:06 
GeneralRe: Which is more correct? Pin
Bardy8517-Jan-10 7:27
Bardy8517-Jan-10 7:27 
GeneralRe: Which is more correct? Pin
#realJSOP17-Jan-10 23:28
mve#realJSOP17-Jan-10 23:28 
AnswerRe: Which is more correct? Pin
DaveyM6917-Jan-10 7:20
professionalDaveyM6917-Jan-10 7:20 
If you want to cache your Employees for use throughout your application and it's acceptable to not reload them (i.e. they will not be changed by someone else acessing the DB) then it's OK to keep a static reference.

One or two points though. Don't make fields public, you should create a static readonly property (i.e. only a getter) to expose the cached List.
If you have a lot of data stored in your list then you may end up with memory issues, so it may be wise to only store the basic information such as ID and Name, and look up the rest of the data when required.

Have you considered using the Singleton pattern and have a Manager/Factory class that creates the list only when it is first needed? It won't offer any huge improvements, but can be a more logical approach. Without knowing the exact requirements and other implementation details it's hard to say but may be worth investigating.

Dave

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: Which is more correct? Pin
Bardy8517-Jan-10 7:43
Bardy8517-Jan-10 7:43 
GeneralRe: Which is more correct? Pin
DaveyM6917-Jan-10 7:55
professionalDaveyM6917-Jan-10 7:55 
GeneralRe: Which is more correct? Pin
Bardy8517-Jan-10 8:27
Bardy8517-Jan-10 8:27 
AnswerRe: Which is more correct? Pin
Luc Pattyn17-Jan-10 9:23
sitebuilderLuc Pattyn17-Jan-10 9:23 
GeneralRe: Which is more correct? Pin
Bardy8517-Jan-10 9:31
Bardy8517-Jan-10 9:31 
GeneralRe: Which is more correct? Pin
Luc Pattyn17-Jan-10 9:32
sitebuilderLuc Pattyn17-Jan-10 9:32 
Question[StructLayout(LayoutKind.Sequential)] Pin
3bood.ghzawi17-Jan-10 5:31
3bood.ghzawi17-Jan-10 5:31 
AnswerRe: [StructLayout(LayoutKind.Sequential)] Pin
Luc Pattyn17-Jan-10 5:43
sitebuilderLuc Pattyn17-Jan-10 5:43 
AnswerRe: [StructLayout(LayoutKind.Sequential)] Pin
0x3c017-Jan-10 5:45
0x3c017-Jan-10 5:45 
AnswerRe: [StructLayout(LayoutKind.Sequential)] Pin
dan!sh 17-Jan-10 6:12
professional dan!sh 17-Jan-10 6:12 
AnswerRe: [StructLayout(LayoutKind.Sequential)] Pin
harold aptroot17-Jan-10 6:28
harold aptroot17-Jan-10 6:28 
AnswerRe: [StructLayout(LayoutKind.Sequential)] Pin
DaveyM6917-Jan-10 7:32
professionalDaveyM6917-Jan-10 7:32 
QuestionExtend BindingSource with a Dirty property and Dirty changed Event Pin
ArjenGroeneveld17-Jan-10 5:20
ArjenGroeneveld17-Jan-10 5:20 
AnswerRe: Extend BindingSource with a Dirty property and Dirty changed Event Pin
Eddy Vluggen17-Jan-10 10:11
professionalEddy Vluggen17-Jan-10 10:11 
GeneralRe: Extend BindingSource with a Dirty property and Dirty changed Event Pin
ArjenGroeneveld17-Jan-10 10:38
ArjenGroeneveld17-Jan-10 10:38 
GeneralRe: Extend BindingSource with a Dirty property and Dirty changed Event Pin
Eddy Vluggen17-Jan-10 13:44
professionalEddy Vluggen17-Jan-10 13:44 
GeneralRe: Extend BindingSource with a Dirty property and Dirty changed Event Pin
ArjenGroeneveld17-Jan-10 21:24
ArjenGroeneveld17-Jan-10 21:24 

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.