IGH_DocumentObject.AttributesChanged Event Question

Hello
How to use IGH_DocumentObject.AttributesChanged Event ?

For example:

......
  foreach (var obj in objects)
  {
      obj.AttributesChanged -= OnAttributesChanged;
      obj.AttributesChanged += OnAttributesChanged;
  }
....
}
private void OnAttributesChanged(IGH_DocumentObject sender, GH_AttributesChangedEventArgs e)
{
    ExpireSolution(true);
}