Variable in C#

mansiten

Новичок
Регистрация
07.09.2023
Сообщения
15
Благодарностей
5
Баллы
3
Help with variable in C#
How can I pass a variable in which I have coordinates 48.2569 that are string, taken from json.
I want to be able to convert them to a number and be able to add another number.

For example
project.Variables["geo_lat"].Value= 48.555

but right now it's a string and can not add any.
How do I change it to Number, and reassign the same value but changin a number.

Thanks
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
var someCoordinate= Convert.ToDouble(project.Variables["latitude"].Value);
//do some maths in here

//at the end convert it back to string rounding to 7 after the dot
project.Variables["latitude"].Value = Math.Round(someCoordinate,7).ToString();


For more fancy stuff with coordinates look in to NET System.Device.Location :az:
 
  • Спасибо
Реакции: mansiten

mansiten

Новичок
Регистрация
07.09.2023
Сообщения
15
Благодарностей
5
Баллы
3
var someCoordinate= Convert.ToDouble(project.Variables["latitude"].Value);
//do some maths in here

//at the end convert it back to string rounding to 7 after the dot
project.Variables["latitude"].Value = Math.Round(someCoordinate,7).ToString();


For more fancy stuff with coordinates look in to NET System.Device.Location :az:
Thanks Bro!! :az:
 
  • Спасибо
Реакции: myndeswx

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)