agocke
agocke
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
The only problem is that it's slower than not dealing with attributes, but you're going to do that anyway, so I'd bet it's likely as fast as anything else that uses attributes
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
In particular, there's functionality to pass down all the attributes on a member that I use for XML. That could get you 90% of the way to your implementation
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
I'd still recommend ripping off as much of Serde as possible. It's a relatively clean design, so I think you would only have to alter a few places.
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
Yeah there's no fundamental way to do transitive analysis in a trim-compatible way with reflection
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
If you want a trim-compatible serializer, you will almost certainly need a source generator
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
Yeah, sorry. Maybe you can fork Serde and save yourself some effort?
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
So my question here is: do you control this format, or are you forced to use it? If you are forced to use it, this might be hard, since this format has a strong connection between exactly what gets outputted and the source code. Serde is designed for a looser connection
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
I do have prototype support for getting the attribute info, but it's opt-in per type and could be slower since it needs to be init'ed
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
The actual code that the source generation emits looks like
void Serialize(ISerializer serializer)
{
var typ = serializer.SerializeType("C", 3);
typ.SerializeField("I", this.I);
typ.SerializeField("S", this.S);
typ.SerializeField("C", this.C);
}
void Serialize(ISerializer serializer)
{
var typ = serializer.SerializeType("C", 3);
typ.SerializeField("I", this.I);
typ.SerializeField("S", this.S);
typ.SerializeField("C", this.C);
}
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
Othewrise you can't really share a single source generator for every format
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
The problem will be changing the format in the source generator. The general idea is that you should split your format and your source generation
33 replies
CC#
Created by 230V on 5/18/2023 in #help
✅ a class implementing a generic interface with more than one interface as one generic type argument
Yup, it should be extensible. Which format were you thinking of?
33 replies