public static void Main()
var result = AssignProperties(instanceA,instanceB,instanceC);
public static T AssignProperties<T>(params T[] sources)
var filteredPropertyTypes = new []{typeof(int),typeof(string),typeof(short),typeof(byte),typeof(DateTime),typeof(double)};
var newInstance = (T)Activator.CreateInstance(typeof(T));
foreach(var property in typeof(T).GetProperties().Where(x=>filteredPropertyTypes.Contains(x.PropertyType)))
var defaultValue = property.PropertyType.IsValueType ? Convert.ChangeType(Activator.CreateInstance(property.PropertyType),property.PropertyType) : null;
if(sources.Any(x=>!Convert.ChangeType(property.GetValue(x),property.PropertyType).Equals(defaultValue)))
var newValue = property.GetValue(sources.First(x=>!Convert.ChangeType(property.GetValue(x),property.PropertyType).Equals(defaultValue)));
property.SetValue(newInstance,newValue);
public string Sample1 { get; set; }
public int Sample2 { get; set; }
public short Sample3 { get; set; }
public byte Sample4 { get; set; }
public DateTime Sample5 { get; set; }
public double Sample6 { get; set; }