/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(Country.GetHashCode() * 19 ^ City.GetHashCode() * 17 ^ Street.GetHashCode() * 13 ^ (PostalCode.IsNotNullOrEmpty() ? PostalCode.GetHashCode() * 11 : 0) ^ (HouseNumber.IsNotNullOrEmpty() ? HouseNumber.GetHashCode() * 7 : 0) ^ (FloorLevel.IsNotNullOrEmpty() ? FloorLevel.GetHashCode() * 5 : 0) ^ (Region.IsNotNullOrEmpty() ? Region.GetHashCode() * 3 : 0) ^ (Timezone.IsNotNullOrEmpty() ? Timezone.GetHashCode() : 0)); } }
/// <summary> /// Return a text-representation of this object. /// </summary> public override String ToString() => String.Concat(Country.CountryName.FirstText(), ", ", City, ", ", Street, PostalCode.IsNotNullOrEmpty() ? ", " + PostalCode : "", HouseNumber.IsNotNullOrEmpty() ? ", " + HouseNumber : "", FloorLevel.IsNotNullOrEmpty() ? ", " + FloorLevel : "", Region.IsNotNullOrEmpty() ? ", " + Region : "", Timezone.IsNotNullOrEmpty() ? ", " + Timezone : "");
/// <summary> /// Return a XML representation of this EVSE data record. /// </summary> /// <param name="XName">The XML name to use.</param> /// <param name="CustomAddressSerializer">A delegate to serialize custom Address XML elements.</param> public XElement ToXML(XName XName = null, CustomXMLSerializerDelegate <Address> CustomAddressSerializer = null) { var XML = new XElement(XName ?? OICPNS.EVSEData + "Address", new XElement(OICPNS.CommonTypes + "Country", Country.Alpha3Code), new XElement(OICPNS.CommonTypes + "City", City.FirstText()), new XElement(OICPNS.CommonTypes + "Street", Street), PostalCode.IsNotNullOrEmpty() ? new XElement(OICPNS.CommonTypes + "PostalCode", PostalCode) : null, HouseNumber.IsNotNullOrEmpty() ? new XElement(OICPNS.CommonTypes + "HouseNum", HouseNumber) : null, FloorLevel.IsNotNullOrEmpty() ? new XElement(OICPNS.CommonTypes + "Floor", FloorLevel) : null, Region.IsNotNullOrEmpty() ? new XElement(OICPNS.CommonTypes + "Region", Region) : null, Timezone.IsNotNullOrEmpty() ? new XElement(OICPNS.CommonTypes + "TimeZone", Timezone) : null ); return(CustomAddressSerializer != null ? CustomAddressSerializer(this, XML) : XML); }