internal static IEnumerable <Code> BuildAddressCodesRequest(CustomerAddress address) { IList <Code> _addrcodes = new List <Code>(); if (AddressProperties == null) { AddressProperties = address.GetType().GetProperties(); } // write property names foreach (PropertyInfo propertyInfo in AddressProperties) { if (propertyInfo.Name.EndsWith("Code") && propertyInfo.GetValue(address) != null) { _addrcodes.Add( new Code { BusinessTerm = businessTermsDocument.SelectSingleNode("/Mappings/Property[@Name='" + propertyInfo.Name + "']").Attributes["BusinessTermName"].InnerText, CodeValue = propertyInfo.GetValue(address).ToString(), PropertyName = propertyInfo.Name }); } } return(_addrcodes); }