In C#, it's widely accepted to handle encapsulation using a private field and a public property.
Normally, for static fields you would instantiate the field on application startup unless you expose setting the public property in which the private field can be updated at another time.
For example:
private static CultureInfo cultureInfo = new CultureInfo("pt-BR");
public static CultureInfo CultureInfo { get { return cultureInfo; } }
Question 1 What's the difference between the two examples?
In your first example:
public static CultureInfo __cultureInfo { get; set; }
public static CultureInfo cultureInfo
{
get
{
if (__cultureInfo == null)
__cultureInfo = new CultureInfo("pt-BR");
return __cultureInfo;
}
}
You're exposing both the field and the property. Furthermore, you're allowing the field to be set which is the primary aim of the property (to keep the field the same).
In your second example:
public static CultureInfo cultureInfo = new CultureInfo("pt-BR");
You're simply exposing a public field which is able to be retrieved and modified by everything.
Question 2 What's the correct way?
Neither of those ways are ideal because they both have their downsides, as previously stated.
The example I provided at the beginning of this answer is a more widely accepted way of dealing with the exposure of fields through properties, so that's what I would personally recommend for your examples.