private static ExtensionResult createSystemTimeExt(P.Time time) { var serialized = time.ToString(); var bytes = Encoding.UTF8.GetBytes(serialized); return(new ExtensionResult(EXT_TYPE_TIME, bytes.AsMemory())); }
private static string convertToXmlString(object value) { return(value switch { bool bl => XmlConvert.ToString(bl), Byte by => XmlConvert.ToString(by), // Not used in FHIR serialization Char cr => XmlConvert.ToString(cr), // Not used in FHIR serialization DateTime dt => XmlConvert.ToString(dt, FMT_FULL), // Obsolete: use DateTimeOffset instead!! decimal dec => XmlConvert.ToString(dec), Double dbl => XmlConvert.ToString(dbl), Int16 i16 => XmlConvert.ToString(i16), Int32 i32 => XmlConvert.ToString(i32), Int64 i64 => XmlConvert.ToString(i64), // Not used in FHIR serialization SByte sb => XmlConvert.ToString(sb), // Not used in FHIR serialization Single sing => XmlConvert.ToString(sing), // Not used in FHIR serialization UInt16 uint16 => XmlConvert.ToString(uint16), // Not used in FHIR serialization UInt32 uint32 => XmlConvert.ToString(uint32), // Not used in FHIR serialization UInt64 uint64 => XmlConvert.ToString(uint64), // Not used in FHIR serialization byte[] barr => System.Convert.ToBase64String(barr), DateTimeOffset dto => XmlConvert.ToString(dto, FMT_FULL), Uri uri => uri.ToString(), P.DateTime pdt => pdt.ToString(), P.Time pt => pt.ToString(), P.Date pd => pd.ToString(), Enum en => en.GetLiteral(), BigInteger bi => bi.ToString(), P.Quantity q => q.ToString(), _ => throw Error.NotSupported($"Cannot convert '{value.GetType().Name}' value '{value}' to string"), });