JsConfig.SerializeFn on Interface?

I would like to define a custom serialization method for types that implement an interface; however, JsConfig<ISomething>.RawSerialzieFn doesn’t get picked up.

Other suggestions?

No there’s nothing by interface, that would be very expensive to check for every interface for every type.

You could do the inverse, have a method that scans all assemblies for types that implement an interface and use reflection to register the same RawSerializeFn handler for each type.

That’s what I was thinking, but the syntax is a little funky to set JsConfig func<T,string> values dynamically. Poking around with that now, trying to get the correct way to create the function delegate with runtime type.

Looks like I got it working. :wink: thank you

1 Like