Skip to content

Conversation

@gonzalozawa
Copy link
Contributor

Hi @klauste, could you please review? Thanks!

{
// Set CurrentCulture to proper handle float data type in json
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gonzalozawa I'm not a fan of playing with threads. Especially that our SDK may be part of a much bigger environment where changing culture per thread may do a lot of bad things, e.g

I would suggest to try this to change sth in this line:

sb.Append(this.df[key].ToString());

sb.Append(this.df[key].ToString("R"));

Would it work (as per https://msdn.microsoft.com/en-us/library/dwhawy9k.aspx)?

I have limited testing availability here, so even if I accept code review I will assign you back to do functional and take it from there.

@gonzalozawa
Copy link
Contributor Author

Hi @karoltarasiuk, thanks for the review! I agree on the comments. I was trying to find a way to set the CultureInfo.InvariantCulture for the JsonObject class and not just for the specific float conversion.
I have added the changes as suggested, however the CultureInfo.InvariantCulture needs to be specified. I have tested this changing the regional settings and decimal separator in Windows and it looks fine.
Please let me know your comments.
Thanks!

if (this.di.ContainsKey(key))
{
sb.Append(this.di[key].ToString());
sb.Append(this.di[key].ToString("R", CultureInfo.InvariantCulture));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gonzalozawa why did you do it for integers as well? I think floats should be enough but I may be wrong. Can you give me an example?

@gonzalozawa
Copy link
Contributor Author

Hi @karoltarasiuk, updated now. Sorry, my bad on that one, wrong dictionary.

@karoltarasiuk
Copy link
Contributor

@gonzalozawa all good - pushing to functional now and will assign you. Also don't forget to squash commits before merging.

@gonzalozawa gonzalozawa merged commit 6e9690a into master Jul 12, 2016
@gonzalozawa gonzalozawa deleted the LRN-10530 branch July 12, 2016 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants