Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Slow performance on culture
Message
From
20/12/2010 13:50:22
 
 
To
20/12/2010 11:00:17
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01493324
Message ID:
01493391
Views:
42
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform