c# - Parsing values with arguments while using Select -


i have rather simple question, haven't been able solve while now, after googling. have following command execute:

var datafragments = bufferline.split(';').select(double.parse).tolist(); 

however need parsing happen invariantculture. use invariant culture operation, haven't been able figure out how can set appropriate arguments issue.

here example data want parse:

1;-0.002;-0.005;0.994;-0.975;2.560;4.024;-2.700;3.299;86.699;1009.599;28.67; 

you can use overload of double.parse takes iformatprovider, cultureinfo implements:

var datafragments = bufferline.split(';').select(s => double.parse(s, cultureinfo.invariantculture)).tolist(); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -