Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why do we need to re-build the dictionary?
Message
De
02/06/2017 04:01:02
 
 
Information générale
Forum:
C#
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01651719
Message ID:
01651735
Vues:
48
>Hi everybody,
>
>I see the following code being called:
>
>
> static public Dictionary<string, object> GetPreferenceDictionary()
>        {
>            return BuildPreferencesDictionary();
>        }
>
>
>
>and then in the same class
>
>
> static private Dictionary<string, object> BuildPreferencesDictionary()
>        {
>            Dictionary<string, object> preferenceDictionary = new Dictionary<string, object>();
>           //loading code here
>
>            return preferenceDictionary;
>        }
>
>
>
>this method is called many times.
>
>Why cannot we just return the dictionary if it was already created?

Maybe because the dictionary content might change between calls ? Where is it loaded from ?

> What do I need to change here to make this simpler and to build only once?
>
>Thanks in advance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform