I'm trying to user the Union type in Language-Ext and am getting error: "Target runtime doesn't support default interface implementation" for the method name and "The type or namespace name 'InconsistentFirstName' could not be found"
My code looks like this:
[Union]
public interface Inconsistency
{
public Inconsistency InconsistentFirstName(string localValue, string contactCentreValue);
public Inconsistency InconsistentSurname(string localValue, string contactCentreValue);
public string GetFieldName(Inconsistency inconsistency)
=> inconsistency switch
{
InconsistentFirstName n => "Name",
InconsistenctSurname s => "Surname",
_ => ""
};
}
GetFieldNameneeds to be added to a separate class file. There is a partial class that is automatically code generated calledInconsistencyCon, so what I was trying to achieve can be done with the following code: