CanSetFieldValue<T> method

bool CanSetFieldValue<T>(
  1. T field,
  2. T value
)
Sets value of field. The field. The value.

Implementation

bool CanSetFieldValue<T>(T field, T value) {
  bool applyChange;
  if (field == null) {
    applyChange = value != null;
  } else {
    if (field is Comparable<T>) {
      Comparable<T> c = field;
      applyChange = value != null && c.compareTo(value) != 0;
    } else {
      applyChange = true;
    }
  }
  return applyChange;
}