Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slow performance on culture
Message
 
À
19/12/2010 21:46:56
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:
01493532
Vues:
76
You shouldn't do this on every culture formatting operation. Instead you should set your culture format once in the app and then re-use those settings for all format operations. If that's not possible for whatever reason then at least cache the CultureInfo structures in a Dictionary< string,CultureInfo > structure and retrieve the pre-set culture instead of recreating and re-customizing each time. Loading up a culture is expensive as .NET has to populate all those culture specific values from the OS each time.

If this is a Web app you should do this once in the beginning of a request Application_BeginRequest and then simply use CultureInfo.

You can find more info on this here:
http://www.west-wind.com/presentations/wwDbResourceProvider/introtolocalization.aspx

There's a section on "Assigning Culture in ASP.NET" that shows how to do this exact thing (setting the currency symbol specifically).

In desktop applications you'd do the same thing either when the Application starts for the first time, or when the user switches locales (bad idea) on the fly within the application.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform