0
동일한 클래스의 인스턴스를 비교하십시오. 신구가 동일한 경우 동일한 클래스의 인스턴스를 비교하고 이전 값을 새 값으로 업데이트하십시오.
public class Student()
{
public string Name {get; set;}
public string Hobby {get; set;}
public string Country {get; set;}
}
Student old = new Student { Name = "A", Hobby = "Swim", Country = "HK" };
Student new = new Student { Name = "A", Hobby = "Jog", Country = "US" };
다른, 다른 클래스의 필드의 각 교체, 비교. 이전 값을 새 값으로 업데이트하는 것과 같습니다.
If(old != new)
{
UpdateOldWithNew(old, new);
}
은 아마 당신은 함수 ....이 작업을 수행 만들어야합니다? 각 부분을 비교하면됩니다. –
https://msdn.microsoft.com/en-ca/library/ms173147(v=vs.90).aspx – Derek
클래스의 수정 된 값만 업데이트하면 제네릭 함수가 업데이트됩니까? – superhuman1314