VkNet.Model.Coordinates.FromJson C# (CSharp) Method

FromJson() public static method

Разобрать из json.
public static FromJson ( VkResponse response ) : Coordinates
response VkResponse Ответ сервера.
return Coordinates
        public static Coordinates FromJson(VkResponse response)
        {
            // TODO: TEST IT!!!!!
            var latitudeWithLongitude = ((string)response).Split(' ');
            if (latitudeWithLongitude.Length != 2)
                throw new VkApiException("Coordinates must have latitude and longitude!");

            double latitude;
            if (!double.TryParse(latitudeWithLongitude[0].Replace(".", ","), out latitude))
                throw new VkApiException("Invalid latitude!");

            double longitude;
            if (!double.TryParse(latitudeWithLongitude[1].Replace(".", ","), out longitude))
                throw new VkApiException("Invalid longitude!");

            var coordinates = new Coordinates { Latitude = latitude, Longitude = longitude };

            return coordinates;
        }
Coordinates