views:

27

answers:

1

I am writing extensions to a web app that doesn't need to be localized. As the company grows I believe there is a possibility that there may be some effort in the future to do this localization.

Mindful of that I would like to mark all of the place that I am using country-specific date formats in an attribute on the method, for example:

            For Each exception As String In exceptionDates
                Dim DateBits() As String = exception.Split("/")
                dates.Add(New Date(Integer.Parse(DateBits(2)) _
                               , Integer.Parse(DateBits(0)) _
                               , Integer.Parse(DateBits(1))))
            Next

Any suggestions on either what attribute to use, a generic attribute, or some other mechanism (other that putting a funky comment in the code 'NOTLOCALIZEDMOFO!). .NET 3.5 mixed language app.

+1  A: 

Pass CultureInfo.InvariantCulture where possible.

In particular, you should replace that code with dates.Add(DateTime.ParseExact(exceptions, "M/d/yyyy", CultureInfo.InvariantCulture));

SLaks
Hey that's a lot better than the code I was using, thanks for the tip.
Joseph V