I run sgen
against my assembly with a metric ton of types. I want to exclude 2 types from serialization. I don't seem to be able to find a way to do it.
I see that sgen
has a /type
switch to specify a specific type, but nothing to exclude a specific type.
Is there a way to exclude specific types from serialization?
Apart from putting the types you wish to exclude in a different assembly, you cannot exclude types from the serializer generation.
Update
Other posters have come up with additional possibilities to exclude specific types, with varying applicability based on your use case.