From 7d604188ec0cee3f1cf5debae10c8484cd67c7f1 Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Tue, 18 Jul 2023 18:15:57 +0200 Subject: [PATCH] Add union paragraph --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index bd24a4b4..f3b33070 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ from schema restrictions * Optionally generate interfaces for groups and attribute groups * Optionally generate one file per class * Support for nullable reference types (NRTs) through [`AllowNullAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.allownullattribute) and [`MaybeNullAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.maybenullattribute) +* Optionally generate a common specific type for union member types Unsupported: @@ -180,6 +181,9 @@ Options: --ca, --commandArgs generate a comment with the exact command line arguments that were used to generate the source code (default is true) + --uc, --unionCommonType + generate a common type for unions if possible ( + default is false) ``` For use from code use the [library NuGet package](https://www.nuget.org/packages/XmlSchemaClassGenerator-beta/): @@ -432,6 +436,14 @@ If the range specified by `minInclusive` and `maxInclusive` does not fit in any >=29string +Unions +------ + +If you specify `--unionCommonType`, XmlSchemaClassGenerator will try to determine a common type for a union's member types. If, for example, the member types +are all integer types, then the narrowest integer type will be used that can fit all member types. + +Note that semantic issues might arise with this approach. For example, `DateTime` values are serialized with both date and time information included. See discussion at [#397](https://github.com/mganss/XmlSchemaClassGenerator/issues/397). + Contributing ------------