# Numeric values and Culture Info

**URL:** <https://community.thinkgeo.com/t/numeric-values-and-culture-info/3074>\
**Category:** WPF\
**Created:** [September 26, 2011, 11:47am UTC](https://community.thinkgeo.com/t/numeric-values-and-culture-info/3074 "2011-09-26T11:47:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Puthirak](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@Puthirak](https://community.thinkgeo.com/u/Puthirak)\
**Post date:** [September 26, 2011, 11:47am UTC](https://community.thinkgeo.com/t/numeric-values-and-culture-info/3074/1 "2011-09-26T11:47:17Z")

</div>

&nbsp;Hi,

&nbsp;  
I&nbsp;have&nbsp;some&nbsp;questions&nbsp;about&nbsp;the&nbsp;culture&nbsp;info&nbsp;used&nbsp;for&nbsp;the&nbsp;numeric&nbsp;values:  
&nbsp;  
1)&nbsp;In&nbsp;which&nbsp;culture&nbsp;info,&nbsp;is&nbsp;the&nbsp;string&nbsp;(representing&nbsp;numeric&nbsp;values)&nbsp;obtained&nbsp;from&nbsp;the&nbsp;ColumnValues  
of&nbsp;a&nbsp;feature&nbsp;contained&nbsp;in&nbsp;a&nbsp;shapefile&nbsp;?  
&nbsp;  
2)&nbsp;For&nbsp;the&nbsp;custom&nbsp;numeric&nbsp;values&nbsp;passed&nbsp;through&nbsp;the&nbsp;callback&nbsp;CustomColumnFetch&nbsp;to&nbsp;thinkgeo,&nbsp;what&nbsp;culture&nbsp;info  
should&nbsp;be&nbsp;used&nbsp;?  
&nbsp;  
3)&nbsp;For&nbsp;user&nbsp;created&nbsp;features&nbsp;in&nbsp;an&nbsp;InMemoryFeatureLayer,&nbsp;what&nbsp;culture&nbsp;info&nbsp;should&nbsp;be&nbsp;used&nbsp;for&nbsp;the&nbsp;numeric&nbsp;values&nbsp;?  
&nbsp;  
&nbsp;  
Regards,  
P.OM  
Reportive  
&nbsp;  
PS:&nbsp;I&nbsp;first&nbsp;assumed&nbsp;that&nbsp;it&nbsp;was&nbsp;always&nbsp;the&nbsp;Invariant&nbsp;Culture&nbsp;but&nbsp;it's&nbsp;not&nbsp;always&nbsp;the&nbsp;case.  
&nbsp;  
PS:&nbsp;Is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;provide&nbsp;numeric&nbsp;values&nbsp;as&nbsp;double&nbsp;and&nbsp;not&nbsp;string&nbsp;?

---

<div class="post-metadata">

**Author:** ![Gary2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@Gary2](https://community.thinkgeo.com/u/Gary2)\
**Post date:** [September 27, 2011, 2:02pm UTC](https://community.thinkgeo.com/t/numeric-values-and-culture-info/3074/2 "2011-09-27T14:02:05Z")

</div>

Hello&nbsp;Puthirak,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;post.&nbsp;  
&nbsp;&nbsp;  
&nbsp;There&nbsp;are&nbsp;two&nbsp;cultures,&nbsp;Invariant&nbsp;Culture&nbsp;and&nbsp;Current&nbsp;Culture,&nbsp;and&nbsp;which&nbsp;one&nbsp;should&nbsp;be&nbsp;use&nbsp;is&nbsp;depend&nbsp;on&nbsp;your&nbsp;data.&nbsp;  
&nbsp;&nbsp;  
&nbsp;For&nbsp;example:&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double&nbsp;data&nbsp;=&nbsp;123456789.1234;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data&nbsp;.ToString("N",&nbsp;CultureInfo.InvariantCulture);&nbsp;&nbsp;&nbsp;//output&nbsp;is&nbsp;123,456,789.12&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data.ToString("N",&nbsp;CultureInfo.GetCultureInfo("de-de"));&nbsp;&nbsp;&nbsp;//output&nbsp;is&nbsp;123.456.789.12&nbsp;  
&nbsp;&nbsp;  
&nbsp;InvariantCulture&nbsp;will&nbsp;always&nbsp;use&nbsp;the&nbsp;same&nbsp;format&nbsp;ignore&nbsp;your&nbsp;local&nbsp;machine&nbsp;culture.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary

---

<div class="post-metadata">

**Author:** ![Puthirak](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@Puthirak](https://community.thinkgeo.com/u/Puthirak)\
**Post date:** [September 29, 2011, 3:13am UTC](https://community.thinkgeo.com/t/numeric-values-and-culture-info/3074/3 "2011-09-29T03:13:49Z")

</div>

&nbsp;Hi&nbsp;Gary,

&nbsp;  
I&nbsp;don't&nbsp;know&nbsp;if&nbsp;you&nbsp;understood&nbsp;my&nbsp;questions&nbsp;or&nbsp;not.  
I&nbsp;will&nbsp;try&nbsp;to&nbsp;be&nbsp;more&nbsp;clear.  
&nbsp;  
Let's&nbsp;say&nbsp;I&nbsp;have&nbsp;a&nbsp;shapefile&nbsp;containing&nbsp;polygons.  
I&nbsp;apply&nbsp;a&nbsp;ClassBreakStyle&nbsp;style&nbsp;using&nbsp;a&nbsp;custom&nbsp;column,&nbsp;i.e.&nbsp;the&nbsp;value&nbsp;is&nbsp;given  
by&nbsp;me&nbsp;through&nbsp;the&nbsp;callback&nbsp;CustomColumnFetch.  
This&nbsp;value&nbsp;must&nbsp;be&nbsp;of&nbsp;type&nbsp;string.&nbsp;So&nbsp;I&nbsp;have&nbsp;to&nbsp;convert&nbsp;my&nbsp;double&nbsp;value&nbsp;to&nbsp;a&nbsp;string.  
That's&nbsp;one&nbsp;conversion.  
&nbsp;  
Also&nbsp;I&nbsp;can&nbsp;safely&nbsp;state&nbsp;that&nbsp;when&nbsp;the&nbsp;thinkgeo&nbsp;style&nbsp;engine&nbsp;will&nbsp;try&nbsp;to&nbsp;apply&nbsp;the&nbsp;style,&nbsp;it&nbsp;will  
convert&nbsp;the&nbsp;string&nbsp;given&nbsp;by&nbsp;me&nbsp;to&nbsp;a&nbsp;double.  
That's&nbsp;the&nbsp;second&nbsp;conversion.  
&nbsp;  
My&nbsp;question&nbsp;is:&nbsp;what&nbsp;Culture&nbsp;Info&nbsp;did&nbsp;the&nbsp;thinkgeo&nbsp;style&nbsp;engine&nbsp;use&nbsp;to&nbsp;make&nbsp;the&nbsp;second&nbsp;conversion?  
&nbsp;  
Let's&nbsp;assume&nbsp;that&nbsp;the&nbsp;thinkgeo&nbsp;engine&nbsp;use&nbsp;the&nbsp;Current&nbsp;Culture.&nbsp;So&nbsp;I&nbsp;just&nbsp;have&nbsp;to&nbsp;use&nbsp;the&nbsp;Current&nbsp;Culture  
to&nbsp;make&nbsp;the&nbsp;first&nbsp;conversion.&nbsp;Everythings&nbsp;fine&nbsp;right?  
&nbsp;  
But&nbsp;wait,&nbsp;what&nbsp;if&nbsp;something&nbsp;changed&nbsp;the&nbsp;Current&nbsp;Culture&nbsp;between&nbsp;the&nbsp;moment&nbsp;the&nbsp;engine&nbsp;gets&nbsp;the&nbsp;string&nbsp;value  
and&nbsp;the&nbsp;moment&nbsp;it&nbsp;makes&nbsp;the&nbsp;conversion.&nbsp;You'll&nbsp;potentially&nbsp;get&nbsp;an&nbsp;exception.  
&nbsp;  
That's&nbsp;my&nbsp;main&nbsp;concern.&nbsp;For&nbsp;me,&nbsp;the&nbsp;string&nbsp;given&nbsp;by&nbsp;the&nbsp;users&nbsp;should&nbsp;always&nbsp;be&nbsp;in&nbsp;the&nbsp;Invariant&nbsp;Culture&nbsp;and  
the&nbsp;engine&nbsp;should&nbsp;always&nbsp;use&nbsp;the&nbsp;Invariant&nbsp;Culture&nbsp;to&nbsp;make&nbsp;the&nbsp;conversion.  
&nbsp;  
Regards,  
P.OM  
Reportive  
&nbsp;

---

<div class="post-metadata">

**Author:** ![Howard](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/h/90ced4/32.png) [@Howard](https://community.thinkgeo.com/u/Howard)\
**Post date:** [October 3, 2011, 11:45pm UTC](https://community.thinkgeo.com/t/numeric-values-and-culture-info/3074/4 "2011-10-03T23:45:59Z")

</div>

Hi&nbsp;Puthirak,&nbsp;  
&nbsp;&nbsp;  
&nbsp;For&nbsp;the&nbsp;second&nbsp;conversion,&nbsp;you&nbsp;are&nbsp;exactly&nbsp;right&nbsp;we&nbsp;are&nbsp;using&nbsp;CurrentCulture&nbsp;to&nbsp;convert&nbsp;the&nbsp;string&nbsp;in&nbsp;case&nbsp;we&nbsp;can&nbsp;compare&nbsp;the&nbsp;numeric&nbsp;value&nbsp;to&nbsp;apply&nbsp;the&nbsp;class&nbsp;break&nbsp;style.&nbsp;Also&nbsp;you&nbsp;are&nbsp;right&nbsp;again&nbsp;we&nbsp;need&nbsp;use&nbsp;the&nbsp;InvalidCulture&nbsp;for&nbsp;both&nbsp;directions&nbsp;in&nbsp;all&nbsp;the&nbsp;cases&nbsp;you&nbsp;mentioned.&nbsp;Please&nbsp;allow&nbsp;me&nbsp;to&nbsp;report&nbsp;it&nbsp;to&nbsp;our&nbsp;manager&nbsp;for&nbsp;this&nbsp;issue&nbsp;and&nbsp;make&nbsp;it&nbsp;right&nbsp;soon.&nbsp;Just&nbsp;let&nbsp;you&nbsp;know&nbsp;we&nbsp;are&nbsp;on&nbsp;it&nbsp;now&nbsp;and&nbsp;we&nbsp;will&nbsp;review&nbsp;our&nbsp;other&nbsp;similar&nbsp;cases.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Howard
