JeremyLikness / explore-cosmos-db

.NET Core 2.0 project to demonstrate some capabilities of Cosmos DB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

import data failed when parse double

herbat73 opened this issue · comments

it can be fixed by adding CultureInfo.InvariantCulture param
eg.

            Weight[] weights = await transformer.Transform<Weight>(config["USDA_WEIGHT"], arr =>
            {
                return new Weight
                {
                    FoodId = arr[0],
                    Sequence = arr[1],
                    Amount = double.Parse(arr[2], CultureInfo.InvariantCulture),
                    Description = arr[3],
                    WeightGrams = double.Parse(arr[4], CultureInfo.InvariantCulture)
                };
            });