I have a multi-threaded application which parses some text and it needs to use English Culture Info for parsing numbers from this text. So, i do not want to create EngCulture everytime i call the parsing function. Currently i am passing EngCulture as a parameter but i am not happy with this. I want to define the EngCulture as a static member so it will be shared by threads.
Msdn documentation says that "Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe." I am just using the following function, so how could i know whether TryParse uses any instance members of the EngCulture or not?
public static CultureInfo EngCulture = new CultureInfo("en-US", false);
void parser()
{
if (int.TryParse(value, NumberStyles.Number, EngCulture, out num))...
}
CultureInfo.ReadOnly
grant thread safety guarantees? Because read-only and threadsafe are different. – Tabret