Click here to Skip to main content
15,918,516 members

Comments by dahund (Top 5 by date)

dahund 20-Oct-11 17:07pm View    
perfect :-) i think this will work!!! but i would have to clean dictionary from time to time, since garbage collection could have removed some of the objects making my reference invalid!!! But again thank you, have been looking for something like this in a long time.
dahund 20-Oct-11 7:59am View    
No iam trying to create and object for each user that uses the system, and I need to separate these objects from one of the other so I don't have to recreate them all the time (When the object is created it pulls in allot of data from an SQL database, which takes some time) this time.

My idea was that I could use a specific field name for identification of an object, thereby checking if an object with a specific field name exists!!

Maybe there is another way?? naming the object, maybe but dont now how.
dahund 20-Oct-11 7:45am View    
sry, one last question, when working with this object reference. how do i use referenc (key.somemethod()) instead of obj.somemethod ?
dahund 20-Oct-11 7:41am View    
Looks like this is what i need, hopefully you can answer some questions, or correct me I am wrong.

As I understand this, each time I create and object I assign a key(string) which is stored in the Dictionary(cache) next time I want to create a object i first check if the key(string) exists in Dictionary if not I create, else I do something different ( working with object); is this correct ?

and one last thing; Does this check if object runtime reference exists??:

if(!cache.TryGetValue(key, out r)) cache[key] = r = new FileReader(key);

Thx so very much :-)
dahund 20-Oct-11 7:28am View    
SRY did not see the little comment text.