Closed ploeh closed 10 years ago
Hm... Scan is easy to understand, if you already know about this:
var serializer = new XmlContentSerializer(
XmlContentSerializer.CreateTypeResolver(
typeof(UserCreated).Assembly));
Create makes it easier to understand what the return type is.
Yes, but Scan provides a hint about what's actually going on.
My concern about Create is that, based on an Assembly
as input, it sounds a bit magical.
Agreed. And it's probably more important to know what's actually going on (vs what's returned).
Now that
XmlContentSerializer
has aCreateTypeResolver
method, it's possible to create an instance like this:This is better than having to manually create an instance of
TypeResolutionTable
, but now that the building blocks are in place, it'd be nice with an even easier short-cut:In the above example, this method is called
Scan
, but other alternatives are possible: