예제 #1
0
        private string ConvertResidentToString(Resident resident)
        {
            StringBuilder sbResident = new StringBuilder();

            foreach (var property in resident.GetType().GetProperties())
            {
                string propertyName  = property.Name;
                string propertyValue = property.GetValue(resident)?.ToString() ?? "N/A";
                if (string.IsNullOrEmpty(propertyValue))
                {
                    propertyValue = "N/A";
                }
                sbResident.AppendLine($"{propertyName}: {propertyValue}");
            }
            return(sbResident.ToString());
        }