public static void Main()
Industry = "CompanyIndustry",
Created = Convert.ToDateTime("2022-04-04"),
var b = a.ToModel<Business>();
Console.WriteLine(b.Created.Value);
public static class Extentions
public static K ToModel<K>(this object model)
K output = Activator.CreateInstance<K>();
foreach (var localProperty in model.GetType().GetProperties())
var remoteProperty = output.GetType().GetProperty(localProperty.Name);
if (remoteProperty != default && remoteProperty.PropertyType != typeof(DateTime))
remoteProperty.SetValue(output, localProperty.GetValue(model));
public string Name { get; set; }
public int? Location { get; set; }
public string Industry { get; set; }
public DateTime? Created { get; set; }
public bool? IsActive { get; set; }
public string Name { get; set; }
public int? Location { get; set; }
public string Industry { get; set; }
public DateTime Created { get; set; }
public bool? IsActive { get; set; }