Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slow performance on culture
Message
De
20/12/2010 13:50:22
 
 
À
20/12/2010 11:00:17
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01493324
Message ID:
01493391
Vues:
44
>>Don't think there's a question here :-}
>>But I seem to recall suggesting this months ago.....
>
>Basically, I create an object for each language I support at the application level:
>
>
>        Public oCultureInfoEnglish As CultureInfo = Nothing
>        Public oCultureInfoFrench As CultureInfo = Nothing
>        Public oCultureInfoSpanish As CultureInfo = Nothing
>        Public oCultureInfoPortuguese As CultureInfo = Nothing
>
>
>And, I initialize them in the oApp.Initialize() method:
>
>
>            oCultureInfoEnglish = New CultureInfo("en-US")
>            oCultureInfoFrench = New CultureInfo("fr-CA")
>
>
>Then, I simply make a reference to it when needed. This object creation for the culture stuff seems to be CPU extensive and doing it like that doesn't impact the process when I have to call it multiple times.

You can use Lazy(T). This will initialize the object on first access http://msdn.microsoft.com/en-us/library/dd642331.aspx
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform