IRealmObject in .Net SDK

We are using Realm in Xamarin Forms app on Windows 10 and recently we have upgraded to latest version and replaced the RealmObject class with IRealmObject Interface and made correspodning changes.
RealmObject class overrides the Equal method which is not available in the auto generated classes of the models which implements the IRealmObject interface.

Is it completly removed or we can find it somewhere in the auto generated code using some setting or any method? or we have to override it in our relam classes and provide our own implementation?

it was something like this

public override bool Equals(object ob){
if(obj is null)
{
return false;
}
if(ReferenceEqual(this,obj))
{
return true;
}
if(obj is InvalidObject)
{
return !IsValid;
}
if(obj is not IRealmObjectBase iro)
{
return false;
}
return _accessor.Equals(iro.Accessor);
}

Can we achieve this with IRealmObject implementation?

Hi @Dharmendra_Kumar2, the Equals method is also generated by the Source Generator unless you already defined it yourself, so you don’t need to add it yourself if you don’t want to.

Got it. I just removed it and got the implementation of the same. Thank You

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.