Hi
I would like to copy object B into object A. It needs to copy all the fields, except the PK fields, into another instance of the same class.
Like the function below. Would there be any faster / better method to do this?
Thanks
Alexander
public void Assign(Object aObject) {
if (aObject.GetType() != GetType()) {
throw new ApplicationException("Cannot assign to a different class");
}
if (!Type.ReferenceEquals(this, aObject)){
for (int i = 0; i < Fields.Count; i++){
this.SetValue(i, aObject.GetValue(i, false));
}
}
}