示例#1
0
        //public static Address Parse(String Text)
        //{

        //    if (TryParseJSON(JObject.Parse(Text), out Address _Address))
        //        return _Address;

        //    return null;

        //}

        //public static Address ParseAddressJSON(JObject JSONObject, String PropertyKey)
        //{

        //    try
        //    {

        //        if (JSONObject[PropertyKey] is JObject JSON)
        //            return Create(Country.Parse(JSON["country"    ]?.Value<String>()),
        //                                        JSON["postalCode" ]?.Value<String>(),
        //                                       (JSON["city"       ] as JObject)?.ParseI18NString(),
        //                                        JSON["street"     ]?.Value<String>(),
        //                                        JSON["houseNumber"]?.Value<String>(),
        //                                        JSON["floorLevel" ]?.Value<String>(),
        //                                       (JSON["comment"    ] as JObject)?.ParseI18NString());

        //    }
        //    catch (Exception)
        //    { }

        //    return null;

        //}


        #region ToJSON(...)

        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="Embedded">Whether this data is embedded into another data structure.</param>
        public JObject ToJSON(Boolean Embedded = false)

        => JSONObject.Create(

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            FloorLevel.ToJSON("floorLevel"),
            HouseNumber.ToJSON("houseNumber"),
            Street.ToJSON("street"),
            PostalCode.ToJSON("postalCode"),
            PostalCodeSub.ToJSON("postalCodeSub"),
            City.ToJSON("city"),
            Country?.Alpha3Code.ToJSON("country"),
            Comment.ToJSON("comment")

            );