public static void SetObject(AnyReference obj, Zetbox.API.IDataObject newObj) { if (newObj == null) { obj.ObjClass = null; obj.ObjGuid = null; obj.ObjID = null; } else { var cls = newObj.GetObjectClass(_frozenCtx); obj.ObjClass = cls.ExportGuid; if (cls.ImplementsIExportable()) { obj.ObjGuid = ((IExportable)newObj).ExportGuid; obj.ObjID = null; } else { obj.ObjGuid = null; obj.ObjID = newObj.ID; } } }